# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
863632 |
2023-10-20T16:14:08 Z |
Rifal |
Zagrade (COI20_zagrade) |
C++14 |
|
478 ms |
1324 KB |
#include <bits/stdc++.h>
#include <fstream>
//#define endl '\n'
#define mod 1000000007
#define INF 900000000
//#define cin fin
//#define cout fout
//#define fi first
//#define se second
using namespace std;
//ofstream fout("intel.out");
//ifstream fin("intel.in");
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n, q; cin >> n >> q; string ans; stack<int> st;
for(int i = 1; i <= n; i++) {
if(st.empty()) {
st.push(i);
ans.push_back('(');
}
else {
cout << '?' << ' ' << st.top() << ' ' << i << endl;
int x; cin >> x;
if(x == 1) {
st.pop();
ans.push_back(')');
}
else {
st.push(i);
ans.push_back('(');
}
}
}
cout << '!' << ' ' << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
5 ms |
600 KB |
Output is correct |
4 |
Correct |
7 ms |
600 KB |
Output is correct |
5 |
Correct |
5 ms |
600 KB |
Output is correct |
6 |
Correct |
3 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
708 KB |
Output is correct |
8 |
Correct |
3 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
237 ms |
1148 KB |
Output is correct |
3 |
Correct |
468 ms |
1324 KB |
Output is correct |
4 |
Correct |
437 ms |
1288 KB |
Output is correct |
5 |
Correct |
466 ms |
1160 KB |
Output is correct |
6 |
Correct |
444 ms |
900 KB |
Output is correct |
7 |
Correct |
437 ms |
1280 KB |
Output is correct |
8 |
Correct |
478 ms |
1128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |