# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
641598 | 2022-09-17T07:19:31 Z | christinelynn | Zagrade (COI20_zagrade) | C++17 | 882 ms | 1064 KB |
#include <bits/stdc++.h> #define bupol __builtin_popcount #define ll long long #define fi first #define se second #define pb push_back #define pu push using namespace std; const ll MAXN = 4e5+10; const ll MAXS = 4010; const ll INF = 1e9; const ll MOD = 998244353; const ll LOG = 60; typedef pair<ll,ll> pii; typedef pair<pii,ll> ipii; vector <int> v; char ans[MAXN]; int que(int x, int y){ cout << "? " << x << ' ' << y << endl; int te; cin >> te; return te; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, q; cin >> n >> q; for(int i=1; i<=n; i++){ if(v.empty()){ v.pb(i); continue; } v.pb(i); int siz = v.size()-1; int te = que(v[siz-1], v[siz]); if(te==1){ ans[v[siz-1]] = '('; ans[v[siz]] = ')'; v.pop_back(); v.pop_back(); } } for(int i=0; i<v.size()/2; i++) ans[v[i]] = ')'; for(int i=v.size()/2; i<v.size(); i++) ans[v[i]] = '('; cout << "! "; for(int i=1; i<=n; i++) cout << ans[i]; cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 5 ms | 208 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 6 ms | 208 KB | Output is correct |
5 | Correct | 8 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 | 8 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 10 ms | 320 KB | Output is correct |
3 | Correct | 8 ms | 320 KB | Output is correct |
4 | Correct | 7 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 324 KB | Output is correct |
6 | Correct | 9 ms | 208 KB | Output is correct |
7 | Correct | 10 ms | 336 KB | Output is correct |
8 | Correct | 8 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 263 ms | 404 KB | Output is correct |
3 | Correct | 865 ms | 600 KB | Output is correct |
4 | Correct | 623 ms | 512 KB | Output is correct |
5 | Correct | 830 ms | 604 KB | Output is correct |
6 | Correct | 711 ms | 500 KB | Output is correct |
7 | Correct | 882 ms | 840 KB | Output is correct |
8 | Correct | 844 ms | 520 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 696 ms | 1064 KB | Output is correct |
3 | Correct | 807 ms | 868 KB | Output is correct |
4 | Correct | 711 ms | 736 KB | Output is correct |
5 | Correct | 499 ms | 712 KB | Output is correct |
6 | Correct | 849 ms | 912 KB | Output is correct |
7 | Correct | 870 ms | 736 KB | Output is correct |
8 | Correct | 863 ms | 404 KB | Output is correct |