Submission #1015900

# Submission time Handle Problem Language Result Execution time Memory
1015900 2024-07-07T03:33:10 Z warrenn Zagrade (COI20_zagrade) C++14
71 / 100
565 ms 1560 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int n,q;
    cin>>n>>q;

    stack<int>isi;
    char jwb[n+1];

    for(int d=1;d<=n;d++){
        if(isi.empty()){
            isi.push(d);
            jwb[d]='(';
        }
        else{
            cout<<"? "<<isi.top()<<" "<<d<<endl;
            int w;
            cin>>w;
            if(w==0){
                isi.push(d);
                jwb[d]='(';
            }
            else{
                isi.pop();
                jwb[d]=')';
            }
        }
    }

    int ganti=isi.size()/2;

    while(!isi.empty()){
        if(ganti==0){
            jwb[isi.top()]='(';
        }
        else{
            ganti--;
        }
        isi.pop();
    }
    cout<<"! ";
    for(int d=1;d<=n;d++){
        cout<<jwb[d];
    }

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 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 344 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 214 ms 344 KB Output is correct
3 Correct 537 ms 344 KB Output is correct
4 Correct 530 ms 344 KB Output is correct
5 Correct 548 ms 344 KB Output is correct
6 Correct 557 ms 344 KB Output is correct
7 Correct 529 ms 1560 KB Output is correct
8 Correct 565 ms 344 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 -