| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 798748 | exodus_ | Zagrade (COI20_zagrade) | C++14 | 859 ms | 692 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
char result[100001];
int main() {
int N, Q;
stack<int>tunggu;
cin >> N >> Q;
int half=N/2;
bool apa;
for (int i=1; i<=N; i++) {
if(tunggu.empty()==true) {
tunggu.push(i);
} else {
cout << "? " << tunggu.top() << " " << i << endl;
cout << flush;
cin >> apa;
if(apa==true) {
result[tunggu.top()]='(';
result[i]=')';
half--;
tunggu.pop();
} else {
tunggu.push(i);
}
}
}
while(!tunggu.empty()) {
if(half!=0) {
result[tunggu.top()]='(';
half--;
tunggu.pop();
} else {
result[tunggu.top()]=')';
tunggu.pop();
}
}
cout << "! ";
for (int i=1; i<=N; i++) {
cout << result[i];
}
return 0;
}| # | 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... | ||||
