Submission #411975

# Submission time Handle Problem Language Result Execution time Memory
411975 2021-05-26T11:22:42 Z 최서현(#7464) Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 200 KB
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<long long, long long>
#define plll pair<long long, pll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define ff first
#define ss second
#define ee ss.ff
#define rr ss.ss
#define DEBUG

using namespace std;

int main()
{
    int n, q; cin >> n >> q;
    string ans(n, ' ');

    vector<int> ls[n + 1];
    int val = 0;

    for(int i = 0; i < n; ++i)
    {
        ls[val].push_back(i);

        if(!val)
        {
            ans[i] = '(';
            ++val;
        }

        else
        {
            cout << "? " << ls[val - 1].back() + 1 << ' ' << i + 1 << endl; cout.flush();
            int t; cin >> t;
            if(t)
            {
                ans[i] = ')';
                --val;
            }
            else
            {
                ans[i] = '(';
                ++val;
            }
        }
    }

    cout << ans << endl; cout.flush();
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect query ()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect query ((
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect query (())
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect query ((((
2 Halted 0 ms 0 KB -