# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003858 |
2024-06-20T19:08:25 Z |
vjudge1 |
Zagrade (COI20_zagrade) |
C++17 |
|
1 ms |
344 KB |
#include<bits/stdc++.h>
using namespace std;
//cout.flush();
const int MAXN=100010;
int resp[MAXN];
int main(){
int n, q;
cin >> n >> q;
cout << "? 1 " << n;
std::cout << std::flush;
int ehVal;
cin >> ehVal;
if(ehVal){
resp[1] = 1;
int a = 1, f = 0;
stack <int> s;
s.push(1);
int l = 1;
for(int i=2; i<n; i++){
if(l==0){
a++;
resp[i] = 1;
s.push(i);
l = i;
continue;
}
cout << "? " << l << " " << i;
std::cout << std::flush;
int val;
cin >> val;
if(val){
f++;
resp[i] = 2;
s.pop();
if(s.empty()) l = 0;
else l = s.top();
}
else{
a++;
resp[i] = 1;
s.push(i);
l = i;
}
}
resp[n] = 2;
cout << "! ";
for(int i=1; i<=n; i++){
if(resp[i]==1) cout << "(";
else cout << ")";
}
return 0;
}
resp[1] = 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
0 ms |
340 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |