社区讨论
90pts球调,感激不尽
P14007 「florr IO Round 1」查询游戏参与者 5已保存回复 8
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 8 条
- 当前快照
- 1 份
- 快照标识符
- @mhjakf12
- 此快照首次捕获于
- 2025/11/03 23:25 4 个月前
- 此快照最后确认于
- 2025/11/03 23:25 4 个月前
CPP
#include <bits/stdc++.h>
#define Write ios::sync_with_stdio(0);
#define by cin.tie(0);
#define Na1L0n9 cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5 + 10;
const int MOD = 998244353;
ll n, mn, mx;
int main() {
Write by Na1L0n9
cin >> n;
for (ll i = 1, x; i <= n; i++) {
if (mn < i) {
cout << "? " << mn + 1 << " " << i << endl;
cout.flush();
cin >> x;
if (!x) {
mn = i;
}
}
else {
cout << "? " << i + 1 << " " << mn << endl;
cout.flush();
cin >> x;
if (x) {
mn = i;
}
}
if (mx < i) {
cout << "? " << mx + 1 << " " << i << endl;
cout.flush();
cin >> x;
if (x) {
mx = i;
}
}
else {
cout << "? " << i + 1 << " " << mx << endl;
cout.flush();
cin >> x;
if (!x) {
mx = i;
}
}
}
cout << "! " << min(mn, mx) + 1 << " " << max(mn, mx) << endl;
return 0;
}
球跳或证伪皆可
回复
共 8 条回复,欢迎继续交流。
正在加载回复...