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 int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
int query(int a, int b) {
cout << "? " << a << " " << b << endl;
int x; cin >> x;
return x;
}
signed main() {
int n, q;
cin >> n >> q;
vector<int> t(n+1);
for(int i=1; i+1<=n; i++) t[i+1] = t[i] ^ query(i, i+1);
cout << "! ";
for(int i=1; i<=n; i++) cout << (t[i] ? ')' : '(');
cout << endl;
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... |