QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#487302 | #7804. Intersegment Activation | zhangboju | WA | 1ms | 3844kb | C++17 | 884b | 2024-07-22 19:59:29 | 2024-07-22 19:59:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
vector<int> get(int n) {
vector<int> ans = {0};
for (int i = 1; i < n; i++) {
ans.push_back(i);
vector<int> res = ans;
res.pop_back();
reverse(res.begin(), res.end());
for (int x : res) ans.push_back(x);
}
ans.push_back(n - 1);
return ans;
}
int query(int x, int len) {
cout << x + 1 << " " << x + len + 1 << endl;
int val;
cin >> val;
return val;
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int maxx = 0, maxS = 0;
int S = 0;
vector<int> v = get(n - i);
for (int x : v) {
int val = query(i, x);
S ^= (1 << x);
if (val == n) {
return 0;
}
if (val > maxx) {
maxx = val;
maxS = S;
}
}
while (maxS) {
int x = query(i, __builtin_ctz(maxS));
if (x == n) return 0;
maxS -= (1 << __builtin_ctz(maxS));
}
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3844kb
input:
3 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0
output:
1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 3 1 2 1 3 2 2 2 3 2 2 2 3 3 3 3 3
result:
wrong answer format Unexpected end of file - int32 expected