QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#324207 | #8239. Mysterious Tree | ucup-team484# | WA | 4ms | 3636kb | C++17 | 753b | 2024-02-10 16:57:46 | 2024-02-10 16:57:47 |
Judging History
answer
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
int ok(int i, int j, int n) {
while (j > n)
j -= n;
cout << "? " << i << " " << j << endl;
int t; cin >> t;
return t;
}
void solve() {
int n; cin >> n;
for (int i = 1; i <= n; i += 2) {
if (!ok(i, i + 1, n))
continue;
int deg = ok(i, i + 2, n);
if (deg == 1)
deg += ok(i, i + 3, n);
if (deg == 2 || deg == 0 && ok(i + 1, i + 2, n) && ok(i + 1, i + 3, n)) {
cout << "! 2" << endl;
return;
}
break;
}
cout << "! 1" << endl;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int t; cin >> t; while (t--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
2 4 1 0 1 0 4 0 1 1 1
output:
? 1 2 ? 1 3 ? 2 3 ? 2 4 ! 1 ? 1 2 ? 3 4 ? 3 1 ? 3 2 ! 2
result:
ok Correct (2 test cases)
Test #2:
score: 0
Accepted
time: 4ms
memory: 3588kb
input:
87 13 0 0 0 0 0 1 0 1 1 15 0 0 0 0 0 0 1 1 1 7 0 0 0 1 1 1 15 0 0 0 1 0 0 19 0 0 0 0 0 1 1 1 20 0 0 0 0 0 0 0 0 0 0 7 0 0 1 0 1 1 20 0 0 0 0 0 0 0 1 1 1 17 0 0 0 0 0 0 0 0 0 11 1 0 0 14 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 18 0 0 0 0 0 1 0 1 1 14 0 1 0 1 1 20 0 0 0 0 1 0 0 11 0 0 0 1 0 0 11 0 1 0 0 8 0 1 ...
output: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