Submission #1003754

# Submission time Handle Problem Language Result Execution time Memory
1003754 2024-06-20T16:51:00 Z vjudge1 Zagrade (COI20_zagrade) C++17
0 / 100
578 ms 1124 KB
#include <bits/stdc++.h>
using namespace std;

int main(){

    int n,k; cin >> n>> k;

    stack<int> aberto;
    aberto.push(1);

    string res = "(";

    for(int i=2; i<=n; i++){
        if(aberto.size() == 0){
            aberto.push(i);
            res += '(';
        }
        int aux = aberto.top();
        cout << "? "<< aux << ' '<< i<< endl;
        int ans; cin >> ans;
        if(ans == 1){
            aberto.pop();
            res+=')';
        }
        else{
            aberto.push(i);
            res += '(';
        }
    }
    cout << "! " << res << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 4 ms 344 KB Answer length should be 1000, but it is 1001
3 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 Correct 0 ms 344 KB Output is correct
2 Incorrect 578 ms 1124 KB Answer length should be 100000, but it is 100001
3 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 -