QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#613728 | #8239. Mysterious Tree | klhwong# | TL | 0ms | 0kb | C++17 | 695b | 2024-10-05 14:35:46 | 2024-10-05 14:35:47 |
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();
int limit = (n/2)+3;
rep(i,1,limit){
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