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>
#define ll long long
#define ii pair<int, int>
#define ld long double
using namespace std;
const int dv = 1e9 + 7;
const ld eps = 1e-18;
const int sz = 1e5;
int n, q;
bool cek;
string s;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> q;
for(int i = 1; i <= n/2 + ((n/2)%2); i += 2) {
cout << "? " << i << ' ' << i+1 << '\n';
cout << flush;
cin >> cek;
if(cek) {
s = s + "()";
}
else {
s = s + "((";
}
}
for(int i = n/2 + ((n/2)%2); i <= n; i += 2) {
cout << "? " << i << ' ' << i + 1 << '\n';
cout << flush;
cin >> cek;
if(cek) {
s = s + "()";
}
else {
s = s + "))";
}
}
cout << "! " << s << '\n';
}
# | 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... |