Submission #412923

# Submission time Handle Problem Language Result Execution time Memory
412923 2021-05-27T19:26:24 Z couplefire Zagrade (COI20_zagrade) C++17
0 / 100
1094 ms 1224 KB
#include <bits/stdc++.h>
using namespace std;

string ans = "(";

int query(int a, int b){
    cout << "? " << a+1 << " " << b+1 << endl;
    int x; cin >> x;
    return x;
}

int main(){
    cin.tie(0)->sync_with_stdio(false);
    int n, q; cin >> n >> q;
    vector<int> pos; pos.push_back(0);
    for(int i = 1; i<n; i++)
        if(pos.empty() || !query(pos.front(), i)) 
            pos.push_back(i), ans += '(';
        else ans += ')';
    for(int i = 0; i<(int)pos.size()/2; i++)
        ans[pos[i]] = ')';
    cout << "! " << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 13 ms 316 KB Mismatch at position 1. Expected (, found )
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 14 ms 200 KB Output is correct
3 Incorrect 9 ms 312 KB Mismatch at position 1. Expected (, found )
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Mismatch at position 1. Expected (, found )
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1094 ms 1068 KB Output is correct
3 Incorrect 983 ms 1224 KB Mismatch at position 1. Expected (, found )
4 Halted 0 ms 0 KB -