题解归档 - cf2219B1
本文最后由方少年更新于2026 年 6 月 28 日,已超过0天没有更新。如果文章内容或图片资源失效,请留言反馈,将会及时处理,谢谢!
题解归档 - cf2219B1
本文由 cf-code 本地题解库自动归档;公开内容以本地 AC/验证版本为准。
- 本地编号:
cf2219B1 - 本地来源:
problems/cf2219B1/idea.md - 题目链接:https://codeforces.com/contest/2219/problem/B1
- 原始标题:cf2219B1 - Unique Values (Easy version)
思路
cf2219B1 - Unique Values (Easy version)
Pattern
The original problem is interactive, but the hacked format provides the whole
array. Therefore no query simulation is needed.
Exactly one value appears three times and all other values appear twice. Store
the positions for every value and print the three positions of the value whose
position list has length 3.
Checks
python tools/math_reasoning_search.py --problem cf2219B1 -n 5- required
precheck done by plan flag.- Local sample uses the hacked input format rather than the original transcript.
代码
来源:problems/cf2219B1/solution.cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<vector<int>> pos(n + 1);
for (int i = 1; i <= 2 * n + 1; i++) {
int x;
cin >> x;
pos[x].push_back(i);
}
for (int x = 1; x <= n; x++) {
if ((int)pos[x].size() == 3) {
cout << "! " << pos[x][0] << ' ' << pos[x][1] << ' ' << pos[x][2] << '\n';
break;
}
}
}
return 0;
}
~ ~ The End ~ ~
文章标题:题解归档 - cf2219B1
文章链接:https://www.fangshaonian.cn/archives/206/
最后编辑:2026 年 6 月 28 日 19:04 By 方少年
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)