Submission #411976

# Submission time Handle Problem Language Result Execution time Memory
411976 2021-05-26T11:23:49 Z 최서현(#7464) Zagrade (COI20_zagrade) C++17
71 / 100
1211 ms 4280 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 Correct 1 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 15 ms 312 KB Output is correct
4 Correct 13 ms 200 KB Output is correct
5 Correct 8 ms 200 KB Output is correct
6 Correct 14 ms 316 KB Output is correct
7 Correct 5 ms 200 KB Output is correct
8 Correct 9 ms 200 KB Output is correct
# 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 600 ms 3444 KB Output is correct
3 Correct 645 ms 3228 KB Output is correct
4 Correct 1211 ms 3400 KB Output is correct
5 Correct 973 ms 3376 KB Output is correct
6 Correct 924 ms 3320 KB Output is correct
7 Correct 995 ms 4280 KB Output is correct
8 Correct 913 ms 3368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -