# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1011454 | 2024-06-30T13:55:27 Z | vannnnnnnn | Zagrade (COI20_zagrade) | C++14 | 586 ms | 1140 KB |
#include<bits/stdc++.h> using namespace std; int main() { int n, q; scanf("%d %d", &n, &q); char s[n+5]; vector<int>v; s[1]='('; for(int i=1; i<=n; i++) { if(v.empty()) { s[i]='('; v.push_back(i); continue; } printf("? %d %d\n", v.back(), i); fflush(stdout); int ans; scanf("%d", &ans); if(ans==1) { s[v.back()]='('; s[i]=')'; v.pop_back(); } else { v.push_back(i); } } for(int i=0; i<v.size()/2; i++) { s[v[i]-1]=')'; } for(int i=v.size()/2; i<v.size(); i++) { s[v[i]-1]='('; } printf("! "); for(int i=1; i<=n; i++) { printf("%c", s[i]); } printf("\n"); fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 4 ms | 344 KB | Output is correct |
5 | Correct | 4 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 344 KB | Output is correct |
7 | Correct | 5 ms | 432 KB | Output is correct |
8 | Correct | 4 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Mismatch at position 1. Expected ), found ( |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 262 ms | 348 KB | Output is correct |
3 | Correct | 542 ms | 344 KB | Output is correct |
4 | Correct | 536 ms | 344 KB | Output is correct |
5 | Correct | 544 ms | 344 KB | Output is correct |
6 | Correct | 586 ms | 344 KB | Output is correct |
7 | Correct | 528 ms | 1140 KB | Output is correct |
8 | Correct | 556 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 340 KB | Mismatch at position 2. Expected ), found ( |
2 | Halted | 0 ms | 0 KB | - |