QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#884893 | #9734. Identify Chord | zero-range | Compile Error | / | / | C++23 | 781b | 2025-02-06 11:34:08 | 2025-02-06 11:34:11 |
Judging History
This is the latest submission verdict.
- [2025-02-06 11:34:11]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-06 11:34:08]
- Submitted
answer
#include<stdio.h>
int que(int x,int y){
printf("? %d %d\n",x%n+1,y%n+1),fflush(stdout);
int r;scanf("%d",&r);
return r;
}
void res(int x,int y){
printf("! %d %d\n",x%n+1,y%n+1),fflush(stdout);
int t;scanf("%d",&t);
}
int n;
inline void solve(){
scanf("%d",&n);
int h=n/2,l=0,r=h,d;
while((d=que(l,r))==h){
if(n&1){
if(r-l>h) ++l;
else ++r;
}else ++l,++r;
}
int x=que(l+n-1,r),y=que(l+1,r);
int p,t;
if(x>=d&&y>=d) p=x,t=d-1;
else{
bool f=x<d;
int L=1,R=h-1,ans;
while(L<=R){
int mid=L+R>>1;
if(que(f?l+n-mid:l+mid,r)==d-mid) ans=mid,l=mid+1;
else r=mid-1;
}
p=f?l+n-ans:l+ans,t=d-ans-1;
}
if(que(p,r+t)==1) res(p,r+t);
else res(p,r+n-t);
}
int main(){
int T;scanf("%d",&T);
while(T--) solve();
}
Details
answer.code: In function ‘int que(int, int)’: answer.code:3:30: error: ‘n’ was not declared in this scope 3 | printf("? %d %d\n",x%n+1,y%n+1),fflush(stdout); | ^ answer.code: In function ‘void res(int, int)’: answer.code:8:30: error: ‘n’ was not declared in this scope 8 | printf("! %d %d\n",x%n+1,y%n+1),fflush(stdout); | ^ answer.code: In function ‘int que(int, int)’: answer.code:4:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | int r;scanf("%d",&r); | ~~~~~^~~~~~~~~ answer.code: In function ‘void res(int, int)’: answer.code:9:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int t;scanf("%d",&t); | ~~~~~^~~~~~~~~ answer.code: In function ‘int main()’: answer.code:38:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | int T;scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code: In function ‘void solve()’: answer.code:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&n); | ~~~~~^~~~~~~~~