QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371265 | #7804. Intersegment Activation | FOY# | WA | 1ms | 3796kb | C++23 | 889b | 2024-03-30 03:40:04 | 2024-03-30 03:40:05 |
Judging History
answer
#include <iostream>
#include <vector>
#include <bitset>
#include <cassert>
using namespace std;
vector<int> gray(int n) {
vector<int> gray = {0};
for (int i = 1; i < n; i++) {
gray.push_back(i);
for (int j = gray.size()-2; j >= 0; j--) gray.push_back(gray[j]);
}
gray.push_back(n-1);
return gray;
}
int main() {
int n; cin >> n;
for (int i = 0; i < n; i++) {
int best = 0, bestMask = 0;
int mask = 0;
auto g = gray(n-i);
for (int j = 0; j < (1<<(n-i)); j++) {
cout << i+1 << ' ' << i+1+g[j] << endl;
mask ^= (1<<g[j]);
int val; cin >> val;
if (val == n) return 0;
if (val > best) {
best = val;
bestMask = mask;
}
}
assert(mask == 0);
int val;
while (bestMask) {
cout << i+1 << ' ' << i+__builtin_ctz(bestMask)+1 << endl;
bestMask -= bestMask&-bestMask;
int val; cin >> val;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3796kb
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