# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
780794 | 2023-07-12T13:14:33 Z | makanhulia | Zagrade (COI20_zagrade) | C++17 | 802 ms | 1592 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,q; char ans[200005]; ll jumopen,jumclose; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>q; ll x=2; vector <ll> tumpuk; for (int i=1;i<=n;i++) ans[i]=' '; tumpuk.push_back(1); ll y; for (int i=2;i<=n;i++){ if (tumpuk.empty()){ tumpuk.push_back(i); continue; } cout<<"? "<<tumpuk[tumpuk.size()-1]<<" "<<i<<endl; fflush(stdout); cin>>y; if (y==0){ tumpuk.push_back(i); } else{ ans[tumpuk[tumpuk.size()-1]]='('; ans[i]=')'; jumopen++; jumclose++; tumpuk.pop_back(); } } ll u=ceil((long double)n/2)-jumopen; cout<<"! "; fflush(stdout); for (int i=1;i<=n;i++){ if (ans[i]!=' ') { cout<<ans[i]; fflush(stdout); } else if (u!=0){ cout<<")"; fflush(stdout); u--; } else{ cout<<"("; fflush(stdout); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 3 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 10 ms | 208 KB | Output is correct |
5 | Correct | 9 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
8 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 12 ms | 336 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 7 ms | 328 KB | Output is correct |
5 | Correct | 6 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 332 KB | Output is correct |
7 | Correct | 4 ms | 208 KB | Output is correct |
8 | Correct | 5 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 372 ms | 396 KB | Output is correct |
3 | Correct | 680 ms | 400 KB | Output is correct |
4 | Correct | 620 ms | 396 KB | Output is correct |
5 | Correct | 653 ms | 400 KB | Output is correct |
6 | Correct | 546 ms | 420 KB | Output is correct |
7 | Correct | 760 ms | 1088 KB | Output is correct |
8 | Correct | 694 ms | 400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 778 ms | 1592 KB | Output is correct |
3 | Correct | 802 ms | 884 KB | Output is correct |
4 | Correct | 708 ms | 1176 KB | Output is correct |
5 | Correct | 736 ms | 932 KB | Output is correct |
6 | Correct | 633 ms | 1116 KB | Output is correct |
7 | Correct | 710 ms | 996 KB | Output is correct |
8 | Correct | 774 ms | 416 KB | Output is correct |