# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003823 |
2024-06-20T18:31:02 Z |
vjudge1 |
Zagrade (COI20_zagrade) |
C++17 |
|
468 ms |
708 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int ptr1=1, ptr2;
int q;
string ini="", fim="";
cin >> ptr2 >> q;
while(ptr1<ptr2){
if(ptr1+1==ptr2){
cout << "? " << ptr1 << ' ' << ptr2 << endl;
int resp;
cin >> resp;
if(resp==1){
ini.push_back('(');
ini.push_back(')');
}
else{
ini.push_back(')');
ini.push_back('(');
}
break;
}
cout << "? " << ptr1 << ' ' << ptr1+1 << endl;
int r1;
cin >> r1;
cout << "? " << ptr2-1 << ' ' << ptr2 << endl;
int r2;
cin >> r2;
if(r1 && r2){
ptr1+=2;
ptr2-=2;
ini.push_back('(');
ini.push_back(')');
fim.push_back(')');
fim.push_back('(');
}
else if(r1){
ptr1+=2;
ini.push_back('(');
ini.push_back(')');
}
else if(r2){
ptr2-=2;
fim.push_back(')');
fim.push_back('(');
}
else{
ini.push_back('(');
fim.push_back(')');
ptr1++;
ptr2--;
}
}
reverse(fim.begin(), fim.end());
cout << "! ";
cout << ini << fim << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Incorrect |
2 ms |
344 KB |
Mismatch at position 10. Expected ), found ( |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
4 ms |
344 KB |
Mismatch at position 1. Expected ), found ( |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
228 ms |
600 KB |
Output is correct |
3 |
Incorrect |
468 ms |
708 KB |
Mismatch at position 16. Expected ), found ( |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |