# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774212 | 2023-07-05T12:59:22 Z | vjudge1 | Zagrade (COI20_zagrade) | C++17 | 731 ms | 668 KB |
#include<bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); //#define endl "\n" #define ll long long #define N 200005 #define pb push_back int main(){ lalala; int n,q;cin>>n>>q; stack<int> s; char str[n+1]; s.push(1); str[1]='('; for(int i=2;i<=n;i++){ if(s.size()){ int a=s.top(); cout<<"? "<<a<<" "<<i<<endl; int x;cin>>x; if(x==1){ str[i]=')'; str[s.top()]='('; s.pop(); } else{ s.push(i); } } else{ s.push(i); } } int i=1; while(s.size()){ char a='('; if(i>s.size()/2)a=')'; str[s.top()]=a; s.pop(); i++; } cout<<"! "; for(i=1;i<=n;i++)cout<<str[i]; cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 9 ms | 208 KB | Output is correct |
5 | Correct | 10 ms | 208 KB | Output is correct |
6 | Correct | 11 ms | 208 KB | Output is correct |
7 | Correct | 9 ms | 208 KB | Output is correct |
8 | Correct | 4 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Incorrect | 9 ms | 320 KB | Mismatch at position 501. Expected (, found ) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 280 ms | 388 KB | Output is correct |
3 | Correct | 658 ms | 384 KB | Output is correct |
4 | Correct | 699 ms | 392 KB | Output is correct |
5 | Correct | 330 ms | 388 KB | Output is correct |
6 | Correct | 731 ms | 396 KB | Output is correct |
7 | Correct | 608 ms | 668 KB | Output is correct |
8 | Correct | 536 ms | 396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Mismatch at position 3. Expected (, found ) |
2 | Halted | 0 ms | 0 KB | - |