?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
187583481 |
Practice: DaiRuiChen007 |
1624F - 22 | C++14 (GCC 6-32) | Accepted | 15 ms | 12 KB | 2023-01-02 09:39:01 | 2023-01-02 09:39:01 |
// LUOGU_RID: 98493765 #include<bits/stdc++.h> using namespace std; inline int read(int x) { cout<<"+ "<<x<<endl; int ret; cin>>ret; return ret; } int n,sum=0,lst=0; inline bool check(int k) { int q=(k+n-sum%n)%n,p=read(q); sum=(sum+q); if(p>lst) { lst=p; return true; } return false; } signed main() { cin>>n; int l=1,r=n-1,res=0; while(l<=r) { int mid=(l+r)>>1; if(check(mid)) res=mid,r=mid-1; else l=mid+1; } cout<<"! "<<n-res+sum<<endl; return 0; }
?
?
?
?