# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
565095 |
2022-05-20T09:13:17 Z |
Keshi |
Zagrade (COI20_zagrade) |
C++17 |
|
753 ms |
1124 KB |
//In the name of God
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
ll pw(ll a, ll b){
ll c = 1;
while(b){
if(b & 1) c = c * a % mod;
a = a * a % mod;
b >>= 1;
}
return c;
}
int n, q, a[maxn];
vector<int> vec;
int main(){
fast_io;
cin >> n >> q;
for(int i = 1; i <= n; i++){
if(vec.empty()){
vec.pb(i);
continue;
}
cout << "? " << vec.back() << " " << i << "\n";
cout.flush();
char c;
cin >> c;
if(c == '0') vec.pb(i);
else{
a[i] = 1;
vec.pop_back();
}
}
for(int i = 0; i < Sz(vec) / 2; i++){
a[vec[i]] = 1;
}
cout << "! ";
for(int i = 1; i <= n; i++){
if(a[i]) cout << ')';
else cout << '(';
}
cout << "\n";
cout.flush();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
8 ms |
208 KB |
Output is correct |
5 |
Correct |
10 ms |
332 KB |
Output is correct |
6 |
Correct |
8 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
8 |
Correct |
12 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
336 KB |
Output is correct |
4 |
Correct |
6 ms |
336 KB |
Output is correct |
5 |
Correct |
8 ms |
324 KB |
Output is correct |
6 |
Correct |
7 ms |
332 KB |
Output is correct |
7 |
Correct |
7 ms |
208 KB |
Output is correct |
8 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
382 ms |
680 KB |
Output is correct |
3 |
Correct |
646 ms |
1036 KB |
Output is correct |
4 |
Correct |
753 ms |
812 KB |
Output is correct |
5 |
Correct |
653 ms |
724 KB |
Output is correct |
6 |
Correct |
610 ms |
772 KB |
Output is correct |
7 |
Correct |
678 ms |
984 KB |
Output is correct |
8 |
Correct |
677 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
694 ms |
1084 KB |
Output is correct |
3 |
Correct |
532 ms |
952 KB |
Output is correct |
4 |
Correct |
681 ms |
1076 KB |
Output is correct |
5 |
Correct |
644 ms |
1124 KB |
Output is correct |
6 |
Correct |
737 ms |
1076 KB |
Output is correct |
7 |
Correct |
687 ms |
1124 KB |
Output is correct |
8 |
Correct |
662 ms |
848 KB |
Output is correct |