Submission #1003759

# Submission time Handle Problem Language Result Execution time Memory
1003759 2024-06-20T16:52:29 Z vjudge1 Zagrade (COI20_zagrade) C++17
71 / 100
613 ms 1284 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 += '(';
            continue;
        }
        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 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 432 KB Output is correct
4 Correct 5 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 340 KB Output is correct
8 Correct 4 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 300 ms 1116 KB Output is correct
3 Correct 596 ms 1116 KB Output is correct
4 Correct 565 ms 876 KB Output is correct
5 Correct 576 ms 1284 KB Output is correct
6 Correct 572 ms 980 KB Output is correct
7 Correct 560 ms 1208 KB Output is correct
8 Correct 613 ms 1260 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 -