# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
640223 |
2022-09-14T03:19:43 Z |
kebine |
Zagrade (COI20_zagrade) |
C++17 |
|
917 ms |
1012 KB |
#include <bits/stdc++.h>
using namespace std;
int ask(int a, int b){
int ans;
cout << "? " << a << " " << b << endl;
cin >> ans;
return ans;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, t; cin >> n >> t;
stack<int>st;
string ans = "(";
st.push(1);
for(int i = 2; i <= n; i++){
int a = ask(st.top(), i);
if(a){
st.pop();
ans.push_back(')');
if(st.empty() && i != n){
ans.push_back('(');
st.push(i + 1);
i++;
}
} else{
st.push(i);
ans.push_back('(');
}
}
cout << "! " << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
312 KB |
Output is correct |
3 |
Correct |
13 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
7 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 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 |
Incorrect |
0 ms |
208 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
377 ms |
732 KB |
Output is correct |
3 |
Correct |
741 ms |
616 KB |
Output is correct |
4 |
Correct |
917 ms |
680 KB |
Output is correct |
5 |
Correct |
719 ms |
672 KB |
Output is correct |
6 |
Correct |
806 ms |
632 KB |
Output is correct |
7 |
Correct |
880 ms |
1012 KB |
Output is correct |
8 |
Correct |
727 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |