日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

2017 ACM/ICPC Asia Regional Qingdao Online 记录

發(fā)布時間:2024/9/5 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2017 ACM/ICPC Asia Regional Qingdao Online 记录 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

題目鏈接? Qingdao

Problem C

AC自動機還不會,暫時暴力水過。

#include <bits/stdc++.h>using namespace std;#define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a); i >= (b); --i)const int N = 1e5 + 10;string s[N]; int T; int n; int ans;int main(){std::ios::sync_with_stdio(false);cin >> T;while (T--){cin >> n;int id;int maxv = 0;for(int i = 1; i <= n; i++) {cin >> s[i];if (s[i].size() > maxv) {maxv = s[i].size();id = i;}}ans = 1;rep(i, 1, n) if (s[id].find(s[i]) == -1){ ans = 0; break;}if (ans) cout << s[id] << endl;else cout << "No" << endl;}return 0; }

?

Problem J

考慮直接用隊列保存待判斷的元素(出隊or not)

然后直接用鏈表模擬就可以了。

為什么比賽的時候我不會做呢

#include <bits/stdc++.h>using namespace std;#define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a); i >= (b); --i) #define MP make_pair #define fi first #define se secondtypedef long long LL;const int N = 1e5 + 10;struct node{int x, l, r; } a[N];int T; int n, ans; queue <int> q;int main(){scanf("%d", &T);while (T--){scanf("%d", &n);rep(i, 1, n){a[i].l = i - 1;scanf("%d", &a[i].x);a[i].r = i + 1;}a[0].r = 1;a[n + 1].l = n;a[0].x = 0;a[n + 1].x = 1e8;while (!q.empty()) q.pop();rep(i, 1, n) q.push(i);while (!q.empty()){int now = q.front(); q.pop();int suc = a[now].r;int pre = a[now].l;if (a[now].x > a[suc].x){q.push(pre);a[pre].r = a[suc].r;a[a[suc].r].l = pre;a[suc].l = pre;}}ans = 0;int now = a[0].r;while (now <= n){++ans;now = a[now].r;}printf("%d\n", ans);now = a[0].r;while (now <= n){printf("%d ", a[now].x);now = a[now].r;}putchar(10);}return 0; }

?

Problem K

簽到

#include <bits/stdc++.h>using namespace std;#define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a); i >= (b); --i) #define MP make_pair #define fi first #define se secondtypedef long long LL;LL a[1001000], b[1001000]; LL n; int T;int main(){for (LL i = 1; i <= 1000000; ++i) a[i] = i * i * i;rep(i, 1, 999999) b[i] = a[i + 1] - a[i];scanf("%d", &T);while (T--){scanf("%lld", &n);bool fl = false;rep(i, 1, 999999) if (b[i] == n){fl = true;break;}if (fl) puts("YES"); else puts("NO");} return 0; }

  

轉(zhuǎn)載于:https://www.cnblogs.com/cxhscst2/p/7594648.html

總結(jié)

以上是生活随笔為你收集整理的2017 ACM/ICPC Asia Regional Qingdao Online 记录的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。