# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
641138 |
2022-09-16T04:55:33 Z |
kith14 |
Zagrade (COI20_zagrade) |
C++17 |
|
931 ms |
1544 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pairll pair<ll,ll>
#define lpairll pair<ll,pairll>
#define repp(i,a,b) for (ll i = a; i <= b; i++)
#define repz(i,a,b) for (ll i = a; i < b; i++)
#define repm(i,a,b) for (ll i = a; i >= b; i--)
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
const ll N = 1e5+5, MOD = 1e9+7;
ll tc = 1, n, m, fnd[N];
ll x, y, k;
string s, s1, s2, ye = "YES", no = "NO";
char cr[N];
ll ask(ll l, ll r){
cout << "? " << l << " " << r << endl;
cin >> m; return m;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> k;
vector<ll> ntbgt;
ntbgt.pb(1);
cr[1] = '(';
repp(i,2,n){
ll a1;
if (ntbgt.size() && ask(ntbgt.back(),i)){
cr[i] = ')';
ntbgt.pop_back();
}
else{
cr[i] = '(';
ntbgt.pb(i);
}
}
ll sz = ntbgt.size()/2;
repz(i,0,sz){
cr[ntbgt[i]] = ')';
}
cout << "! ";
for (ll i = 1; i <= n; i++){
cout << cr[i];
}
cout << endl;
}
Compilation message
zagrade.cpp: In function 'int main()':
zagrade.cpp:37:8: warning: unused variable 'a1' [-Wunused-variable]
37 | ll a1;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
10 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
8 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
336 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
10 ms |
208 KB |
Output is correct |
6 |
Correct |
10 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
328 KB |
Output is correct |
8 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
340 ms |
356 KB |
Output is correct |
3 |
Correct |
736 ms |
588 KB |
Output is correct |
4 |
Correct |
722 ms |
708 KB |
Output is correct |
5 |
Correct |
812 ms |
456 KB |
Output is correct |
6 |
Correct |
373 ms |
420 KB |
Output is correct |
7 |
Correct |
746 ms |
1068 KB |
Output is correct |
8 |
Correct |
762 ms |
400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
616 ms |
1544 KB |
Output is correct |
3 |
Correct |
698 ms |
952 KB |
Output is correct |
4 |
Correct |
931 ms |
980 KB |
Output is correct |
5 |
Correct |
895 ms |
948 KB |
Output is correct |
6 |
Correct |
657 ms |
1040 KB |
Output is correct |
7 |
Correct |
686 ms |
896 KB |
Output is correct |
8 |
Correct |
552 ms |
516 KB |
Output is correct |