Submission #1099098

# Submission time Handle Problem Language Result Execution time Memory
1099098 2024-10-10T14:37:40 Z lomta Zagrade (COI20_zagrade) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=100005;

int stk[MAXN],top;
int quest(int a,int b){

    cout<<"?" << " "<< a<<" "<<b<<endl;
    int x;cin>>x;
    return x;

}
int main(){
    int n,m;cin>>n>>m;
    string s;
    for(int i=1;i<=n;i++){
        s=s+" ";

        if(top==0 || !quest(stk[top],i)){
            stk[++top]=i;
        }
        else{
            s[stk[top--]-1]='(';
            s[i-1]=')';
        }

    }

    for(int i=1;i<=top/2;i++){
        s[stk[i]-1]=')';
    }
    for(int i=top/2;i<=top;i++){
        s[stk[i]-1]='(';
    }

    cout<< "!" << " " << s <<endl;;

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Answer length should be 2, but it is 33
2 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 -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Mismatch at position 2. Expected ), found (
2 Halted 0 ms 0 KB -