Submission #706281

# Submission time Handle Problem Language Result Execution time Memory
706281 2023-03-06T08:42:39 Z vjudge1 Zagrade (COI20_zagrade) C++17
71 / 100
856 ms 780 KB
#include <bits/stdc++.h>
#include <fstream>
//#define endl '\n'
#define mod 998244353
#define INF 100000000000
#define ll long long
///#define cin fin
///#define cout fout
#define fi first
#define se second
using namespace std;
///ofstream fout("herding.out");
///ifstream fin("herding.in");

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n, q; cin >> n >> q; stack<int> st; st.push(1); string s; s.push_back('(');
    for(int i = 2; i <= n; i++) {
        if(st.empty()) {
            st.push(i);
            s.push_back('(');
            continue;
        }
        cout << '?' << ' ' << st.top() << ' ' << i << endl;
        int ans; cin >> ans;
        if(ans == 1) {
            st.pop();
            s.push_back(')');
        }
        else {
            st.push(i);
            s.push_back('(');
        }
    }
    cout << '!' << ' ' << s << endl;
    return 0;
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 4 ms 208 KB Output is correct
3 Correct 8 ms 320 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 7 ms 316 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 9 ms 320 KB Output is correct
8 Correct 9 ms 320 KB Output is correct
# 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 Correct 382 ms 664 KB Output is correct
3 Correct 856 ms 552 KB Output is correct
4 Correct 810 ms 532 KB Output is correct
5 Correct 781 ms 584 KB Output is correct
6 Correct 812 ms 684 KB Output is correct
7 Correct 796 ms 780 KB Output is correct
8 Correct 427 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -