成就展示柜
TA 还没有布置成就展示柜。
-
个人简介
#include <bits/stdc++.h> using namespace std; long long n,h,f[10]; int main() { cin >> n; h = 2 * n + 2; for(int i = 1;i <= h;i++) { int x; cin >> x; f[x % 10] = f[x % 10] ^ x; } sort(f + 0,f + 9 + 1); cout << f[8] << " " << f[9]; return 0; }#include <bits/stdc++.h> using namespace std; int n, ai; int sum[35]; int all; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; n = n * 2 + 2; for (int i = 1; i <= n; i++) { cin >> ai; all = all ^ ai; for (int pos = 0; pos <= 29; pos++) { // (ai >> pos) & 1 if (ai & (1 << pos)) sum[pos] = sum[pos] ^ ai; } } for (int i = 0; i <= 29; i++) { if (sum[i] == 0 || sum[i] == all) continue; // 有一个数为 sum[i] // 两个数的异或和为 all // 两个数分别为 sum[i], all^sum[i] int x = sum[i]; int y = all ^ sum[i]; cout << min(x, y) << " " << max(x, y) << "\n"; return 0; } return 0; }
这个代码有问题,课上讲过问题在哪儿,自己改 #include <bits/stdc++.h> using namespace std; const int MAXN = 2000000; int n,k,p; int col[MAXN+5],num[MAXN+5]; // cntCol 存当前汇合点前面(不算汇合点)每种颜色有几个 int cntCol[10000+5]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>k>>p; for(int i=1;i<=n;i++) cin>>col[i]>>num[i];
long long cnt=0; int last=-1;//最新汇合点 for(int i=1;i<=n;i++) { if(num[i]<=p) { for(int j=max(1,last);j<i;j++) cntCol[col[j]]++; last = i; } // last 可以汇合 cnt+=cntCol[col[i]]; if(last<i && col[last]==col[i]) cnt++; } cout<<cnt; return 0;}
-
喵喵
你还没有关注该用户,无法查看其信息。
-
成就(14)
-
题海·初帆 通过 1 道题号不同的题目。
-
题海·试帆 通过 2 道题号不同的题目。
-
题海·扬帆 通过 4 道题号不同的题目。
-
题海·云帆 通过 8 道题号不同的题目。
-
题海·逐浪 通过 16 道题号不同的题目。
-
题海·踏浪 通过 32 道题号不同的题目。
-
题海·破浪 通过 64 道题号不同的题目。
-
长明·火种 连续登录 1 天。
-
足迹·初步 累计登录 1 天。
-
足迹·起步 累计登录 2 天。
-
足迹·迈步 累计登录 4 天。
-
足迹·阔步 累计登录 8 天。
-
足迹·旅途 累计登录 16 天。
-
粮仓·初囤 猫粮余额曾达到 1 kg。
-
-
最近活动
-
通过的题目
TA 的小猫
题目标签
- DAI
- 6
- 语法周赛
- 6
- 图论
- 5
- O2优化
- 4
- 递推
- 4
- 各省省选
- 4
- 线段树
- 4
- 测试
- 4
- R31
- 4
- atcoder
- 3
- dp
- 3
- 搜索
- 3
- 树状数组
- 3
- 排序
- 3
- 拓扑排序
- 3
- USACO
- 2
- D
- 2
- 动态规划
- 2
- 数学
- 2
- 深度优先搜索,DFS
- 2