# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773476 | 2023-07-05T05:55:05 Z | vjudge1 | Zagrade (COI20_zagrade) | C++17 | 835 ms | 900 KB |
#include <bits/stdc++.h> using namespace std; void f(){ freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } int qu(int a, int b){ cout<<"? "<<a+1<<" "<<b+1<<endl; cin>>a; return a; } void solve(){ int n, m; cin >> n >> m; string s; stack<int> q; for(int i=0; i < n; i++) s+='.'; q.push(0); for(int i=1; i<n; i++){ if(!q.size()){ q.push(i); } else if(qu(q.top(), i)){ s[q.top()]='('; s[i]=')'; q.pop(); } else{ q.push(i); } } int p=q.size()/2; while(p--){ s[q.top()]='('; q.pop(); } while(q.size()){ s[q.top()]=')'; q.pop(); } cout<<"! "<<s<<endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 312 KB | Output is correct |
2 | Correct | 5 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 6 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 | 9 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 | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 8 ms | 324 KB | Output is correct |
5 | Correct | 5 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 | 7 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 407 ms | 520 KB | Output is correct |
3 | Correct | 681 ms | 524 KB | Output is correct |
4 | Correct | 647 ms | 520 KB | Output is correct |
5 | Correct | 457 ms | 524 KB | Output is correct |
6 | Correct | 567 ms | 520 KB | Output is correct |
7 | Correct | 835 ms | 616 KB | Output is correct |
8 | Correct | 723 ms | 516 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 682 ms | 880 KB | Output is correct |
3 | Correct | 726 ms | 520 KB | Output is correct |
4 | Correct | 753 ms | 900 KB | Output is correct |
5 | Correct | 596 ms | 520 KB | Output is correct |
6 | Correct | 659 ms | 608 KB | Output is correct |
7 | Correct | 572 ms | 644 KB | Output is correct |
8 | Correct | 407 ms | 520 KB | Output is correct |