Submission #706248

# Submission time Handle Problem Language Result Execution time Memory
706248 2023-03-06T07:52:59 Z vjudge1 Zagrade (COI20_zagrade) C++17
0 / 100
204 ms 556 KB
#include <bits/stdc++.h>
// #define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
typedef long long ll;
using namespace std;
const int N = 200000 + 10;
bool vis[N];
signed main() {
    FAST;
    int n, q;
    cin >> n >> q;
    stack<int> st;
    st.push(0);
    vis[0] = 1;
    for(int i = 1; i < n - 1; i++) {
        if(!st.size()) st.push(i);
        else {
            cout << "? " << st.top() + 1 << ' ' << i + 1 << endl;
            int x;
            cin >> x;
            if(x == 1) st.pop();
            else {
                st.push(i);
                vis[i] = 1;
            }
        }
    }
    string s = "";
    for(int i = 0; i < n; i++) {
        if(vis[i]) s += "(";
        else s += ")";
    }
    cout << "! " << s << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 3 ms 208 KB Mismatch at position 3. Expected (, found )
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 204 ms 556 KB Mismatch at position 3. Expected (, found )
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -