# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003767 |
2024-06-20T17:09:31 Z |
vjudge1 |
Zagrade (COI20_zagrade) |
C++17 |
|
612 ms |
1548 KB |
#include<bits/stdc++.h>
using namespace std;
#define N 200010
#define INFLL 2000000000000000020
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> pll;
vector<ll>abre;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,q,i=1;
string ans=" ";
bool ret;
cin >> n >> q;
for(i=1;i<=n;i++)
{
ans+="(";
}
i=1;
while(i<=n)
{
if(abre.empty())
{
abre.pb(i);
i++;
continue;
}
cout << "? " << abre.back() << " " << i << endl;
fflush(stdout);
cin >> ret;
if(ret)
{
ans[i]=')';
abre.pop_back();
}else
{
abre.pb(i);
}
i++;
}
cout << "!" << ans << endl;
fflush(stdout);
return 0;
}
# |
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 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
344 KB |
Output is correct |
8 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
504 KB |
Mismatch at position 1. Expected ), found ( |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
269 ms |
648 KB |
Output is correct |
3 |
Correct |
602 ms |
652 KB |
Output is correct |
4 |
Correct |
600 ms |
644 KB |
Output is correct |
5 |
Correct |
567 ms |
648 KB |
Output is correct |
6 |
Correct |
593 ms |
848 KB |
Output is correct |
7 |
Correct |
612 ms |
1548 KB |
Output is correct |
8 |
Correct |
537 ms |
648 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 |
- |