QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#326627 | #8239. Mysterious Tree | james1BadCreeper# | WA | 0ms | 3628kb | C++14 | 720b | 2024-02-13 16:57:25 | 2024-02-13 16:57:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
int n;
int ask(int u, int v) {
cout << "! " << u << " " << v << endl;
return cin >> u, u;
}
void solve(void) {
cin >> n;
int u = -1, v = -1;
for (int i = 1; i <= n; i += 2)
if (ask(i, i + 1)) { u = i, v = i + 1; break; }
if (ask(n - 1, n)) u = n - 1, v = n;
if (u == -1) return cout << "! 1" << endl, void(); // 一定不是菊花
int t = (u == 1 ? n : 1);
if (!ask(u, t) && !ask(v, t)) return cout << "! 1" << endl, void();
cout << "! 2" << endl;
}
int main(void) {
ios::sync_with_stdio(0);
int T; cin >> T;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
2 4 4
output:
! 1 2 ! 3 4
result:
wrong answer Token parameter [name=type] equals to "2", doesn't correspond to pattern "?|!" (test case 2)