# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411946 | 2021-05-26T10:22:11 Z | 반딧불(#7584) | Zagrade (COI20_zagrade) | C++17 | 1 ms | 200 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, q; char arr[100002]; stack<int> stk; int main(){ scanf("%d %d", &n, &q); for(int i=1; i<=n; i++){ if(stk.empty()) stk.push(i); else{ printf("? %d %d\n", stk.top(), i); fflush(stdout); int ret; scanf("%d", &ret); if(!ret) stk.push(i); else{ arr[stk.top()] = '('; arr[i] = ')'; stk.pop(); } } } int s = (int)stk.size() / 2; while((int)stk.size() > s){ arr[stk.top()] = '('; stk.pop(); } while(!stk.empty()){ arr[stk.top()] = ')'; stk.pop(); } printf("%s", arr+1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Incorrect query () |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Incorrect query )( |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Incorrect query (()) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 200 KB | Incorrect query ))(( |
2 | Halted | 0 ms | 0 KB | - |