QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#613590 | #8239. Mysterious Tree | klhwong# | TL | 0ms | 0kb | C++17 | 669b | 2024-10-05 14:17:19 | 2024-10-05 14:18:08 |
answer
#include <bits/stdc++.h>
using namespace std;
inline int rd(){
int x = 0;
bool f = 0;
char c = getchar();
for(;!isdigit(c);c = getchar()) f |= ( c == '-' );
for(;isdigit(c);c = getchar()) x = x * 10 + ( c ^ 48 );
return f ? -x : x ;
}
#define rep(i,a,b) for(int i = (a); i<=(b);++i)
#define per(i,a,b) for(int i = (a); i>=(b);--i)
#define eb emplace_back
inline void work(){
int n = rd();
rep(i,1,n-1){
printf("? %d %d\n", i , i+1);
if(rd() == 0){
puts("! 2");
return;
}
}
puts("! 1");
return;
}
int main(){
per(i, rd(), 1) work();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
2 4