# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1148704 | Tyx2019 | Zagrade (COI20_zagrade) | C++20 | 232 ms | 1356 KiB |
#include <bits/stdc++.h>
#define int long long
#define debug(x) if(1) cout << #x << " is " << x << endl;
using namespace std;
const int INF = 1e18;
void solve(){
int N, Q;
cin >> N >> Q;
char res[N+5];
for(int i=1;i<=N;i++) res[i] = '?';
int cur = 1;
stack<int> stk;
stk.push(1);
for(int i=2;i<=N;i++){
stk.push(i);
if(stk.size() < 2) continue;
int b = stk.top();
stk.pop();
int a = stk.top();
stk.pop();
cout << "? " << a << " " << b << endl;
int bruh;
cin >> bruh;
if(bruh == 1){
res[a] = '(';
res[b] = ')';
}
else{
stk.push(a);
stk.push(b);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |