当前位置: 首页 > news >正文

网站设计概念好用的网址导航

网站设计概念,好用的网址导航,网站开发所需要的技术,云南专业网站制作公司Problem - D - Codeforces 思路#xff1a; 滑动窗口思想#xff0c;一个数组记录起始点#xff08;记录出现过的次数#xff09;#xff0c;另一个数组记录截至点#xff08;记录出现过的次数#xff09;#xff0c;从0开始遍历#xff0c;设定一个长度为d的滑动窗口…Problem - D - Codeforces 思路 滑动窗口思想一个数组记录起始点记录出现过的次数另一个数组记录截至点记录出现过的次数从0开始遍历设定一个长度为d的滑动窗口用一个数记录滑动窗口内次数的总和当边界d时进行最大值最小值比较滑动窗口每次移动总和都会发生变化因此可以来判断出最大和最小值比较完之后要减去原来起始点的次数值因为此时起始点已经来到了r-d1也就是往右移动了一位. #define _CRT_SECURE_NO_WARNINGS 1 #includebits/stdc.h #includestdio.h #includeunordered_map #includeunordered_set #includeiostream #includealgorithm #includecstring #includevector #includequeue #includemap #includecmath using namespace std; typedef long long ll; #define IOS ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); const int N 2e6 10; void solve() {ll n, d, k;cin n d k;vectorlla(n1);vectorllb(n1);while (k--){ll x, y;cin x y;a[x];b[y];}ll mi 1e9, mx 0;ll mmi, mxx;ll l;for (int r 1, now 0; r n; r)//滑动窗口更新最大值最小值{now a[r];if (r d){l r - d 1;if (now mi){mi now;mmi l;}if (now mx){mx now;mxx l;}now - b[l];//此时已往右移动了一位所以需要减去因为now记录的是滑动窗口里的值}}cout mxx mmi \n;return; } int main() { IOS;ll t;cin t;while(t--)solve();return 0; } Problem - C - Codeforces 思路 利用两个嵌套的vector,第一个预处理数组里的数字第二个预处理字符串先判断当前数据出现次数若未出现过则将i对其进行赋值并以i为小标存入vector中若出现则以其一共出现过的次数为小标存入vector中 #include bits/stdc.h using namespace std; void solve() {int n;cin n;mapint, int mp;vectorint a(n);vector ve(n, vectorint());for (int i 0; i n ; i ) {cin a[i];if (!mp.count(a[i])) {mp[a[i]] i;ve[i].push_back(i);} else {ve[mp[a[i]]].push_back(i);}}int m;cin m;while (m--) {string s;cin s;if (s.size() ! n) {cout NO\n;continue;}mapint, int mp1;vector Ve(n, vectorint());for (int i 0; i s.size(); i ) {if (!mp1.count(s[i])) {mp1[s[i]] i;Ve[i].push_back(i);} else {Ve[mp1[s[i]]].push_back(i);}}cout (Ve ve ? YES\n : NO\n);}}int main() {int t;cin t;while (t--) {solve();}return 0; } P3385 【模板】负环 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 思路 cnt数组记录经过点的个数w数组记录1到各个点的最短距离用spfa来求最短距离每进行一次赋值后对cnt数组进行1若cnt数组的个数n即说明经过了n个或以上个点因为cnt只有找到最小值后进行赋值时才能1所以说明绝对存在负权边即负环因为经过它之后权又变小了 代码 #define _CRT_SECURE_NO_WARNINGS 1 #includebits/stdc.h #includestdio.h #includeunordered_map #includeunordered_set #includeiostream #includealgorithm #includecstring #includevector #includequeue #includemap #includecmath using namespace std; typedef long long ll; #define IOS ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); const int N 2e6 10; struct edge{int id, dis; }; vectoredge a[N]; int n, m, w[N], cnt[N], dis; bool f[N]; bool spfa() {queueintq;q.push(1);w[1] 0;while (!q.empty()) {int u q.front();q.pop();f[u] 0;for (int i 0; i a[u].size(); i) {int v a[u][i].id;dis w[u] a[u][i].dis;if (dis w[v]) {w[v] dis;cnt[v] cnt[u] 1;if (cnt[v]n) {return 1;}if (!f[v]) {q.push(v);f[v] 1;}}}}return 0; } void solve() {memset(w, 0x7f, sizeof(w));memset(cnt, 0, sizeof(cnt));memset(f, 0, sizeof(f));cin n m;int u, v, d;for (int i 1; i m; i){cin u v d;a[u].push_back({ v,d });if (d 0){a[v].push_back({ u,d });}}if (spfa())cout YES\n;else {cout NO\n;}for (int k 1; k n; k){a[k].clear();} } int main(){ IOS;ll t;cin t;while(t--)solve();return 0; }
http://www.w-s-a.com/news/429917/

相关文章:

  • 各电商网站的特点网站制作2007
  • 用html做一号店网站怎么做公众号注册平台官网
  • 做盈利网站怎么备案vs做网站如何调试
  • 嘉兴做营销型网站廊坊做网站外包
  • 双语网站模板常州做网站的公司
  • 广州市车管所网站建设全国做网站公司前十名
  • 太原手手工网站建设公司视频直播服务
  • 雷达图 做图网站wordpress首页怎么美化
  • 四川做网站设计公司价格vip解析网站怎么做的
  • 网站建设流程域名申请做化工的 有那些网站
  • 软件开发设计流程图seo搜索引擎官网
  • 外国小孩和大人做网站东富龙科技股份有限公司
  • 上线倒计时单页网站模板做网站的资金来源
  • 泸州市建设厅网站中小企业网络需求分析
  • asp网站版权做网页价格
  • 长春网站建设路关键词优化公司哪家好
  • 河南省建设银行网站年报天津设计师网站
  • 沙洋网站定制如果自己建立网站
  • 凡科网站怎么做建站关键字搜索网站怎么做
  • 小说网站建站程序企业邮箱地址
  • 福州市住房和城乡建设网站网站开发方案论文
  • 在线教育网站开发网站推广常用方法包括
  • 东莞高端品牌网站建设软件开发模型及特点
  • 个人网站的设计与实现的主要内容网站开发公司架构
  • 浏览器收录网站什么是新媒体营销
  • 上海营销网站建设公司下面哪个不是网页制作工具
  • 有哪些网站可以做设计比赛苏州设计公司排名前十
  • 公益网站建设需求车陂手机网站开发
  • 高端网站建设专业营销团队宁德网站建设51yunsou
  • 网站如何做cdn购物网站建设app开发