# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
780448 | 2023-07-12T09:05:36 Z | devariaota | Zagrade (COI20_zagrade) | C++17 | 1 ms | 356 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,q; char ans[100005]; int main(){ cin>>n>>q; for (int i=1;i<=100005;i++) ans[i]=' '; ll l=1,r=n; ll y=0; while(true){ cout<<">>> ? "<<l<<" "<<r<<endl; fflush(stdout); cin>>y; if (y==0){ l++; r--; ans[l]=')'; ans[r]='('; } else{ ans[l]='('; ans[r]=')'; l++; r--; break; } } ll lo=l,hi=r; while(lo<=hi){ cout<<">>> ? "<<lo-1<<" "<<lo<<endl; fflush(stdout); ll x; cin>>x; if (x==1) { if (ans[lo]==' ') ans[lo]=')'; if (ans[lo+1]==' ') ans[lo+1]='('; lo+=2; } else{ if (ans[lo]==' ') ans[lo]='('; lo+=1; } cout<<">>> ? "<<hi<<" "<<hi+1<<endl; cin>>x; fflush(stdout); if (x==1){ if (ans[hi]==' ') ans[hi]='('; if (ans[hi-1]==' ') ans[hi-1]=')'; hi-=2; } else{ if (ans[hi]==' ') ans[hi]=')'; hi-=1; } } for (int i=1;i<=n;i++){ cout<<ans[i]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 336 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 356 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |