답안 #381471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381471 2021-03-25T08:19:17 Z topovik Zagrade (COI20_zagrade) C++14
71 / 100
932 ms 1004 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define len(x) x.size()
#define debug(x) cout << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef long double ld;

const ll N = 1e6 + 100;
const ll oo = 1e9 + 7;
const ll k = 10;

int main()
{
    int n, q;
    cin >> n >> q;
    stack <int> st;
    string ans;
    for (int i = 0; i < n; i++)
    {
        if (st.size() == 0)
        {
            ans += "(";
            st.push(i);
            continue;
        }
        cout << "? " << st.top() + 1 << " " << i + 1 << endl;
        bool g;
        cin >> g;
        if (g)
        {
            st.pop();
            ans += ")";
        }
        else
        {
            st.push(i);
            ans += "(";
        }
    }
    cout << "! " << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 5 ms 364 KB Output is correct
3 Correct 9 ms 364 KB Output is correct
4 Correct 11 ms 364 KB Output is correct
5 Correct 11 ms 364 KB Output is correct
6 Correct 10 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
8 Correct 9 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 429 ms 1004 KB Output is correct
3 Correct 894 ms 776 KB Output is correct
4 Correct 837 ms 1004 KB Output is correct
5 Correct 834 ms 748 KB Output is correct
6 Correct 828 ms 624 KB Output is correct
7 Correct 932 ms 876 KB Output is correct
8 Correct 878 ms 1004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -