?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
188397632 |
Practice: DaiRuiChen007 |
1520F1 - 18 | C++14 (GCC 6-32) | Accepted | 15 ms | 4 KB | 2023-01-08 11:26:49 | 2023-01-08 11:26:50 |
// LUOGU_RID: 99034870 #include<bits/stdc++.h> using namespace std; const int MAXN=2e5+1; inline int read(int l,int r) { cout<<"? "<<l<<" "<<r<<endl; int ret; cin>>ret; return ret; } int n,T,k; inline bool check(int x) { return x-read(1,x)>=k; } signed main() { cin>>n>>T; while(T--) { cin>>k; int l=1,r=n,res=0; while(l<=r) { int mid=(l+r)>>1; if(check(mid)) res=mid,r=mid-1; else l=mid+1; } cout<<"! "<<res<<endl; } return 0; }
?
?
?
?