답안 #1003767

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003767 2024-06-20T17:09:31 Z vjudge1 Zagrade (COI20_zagrade) C++17
71 / 100
612 ms 1548 KB
#include<bits/stdc++.h>
using namespace std;

#define N 200010
#define INFLL 2000000000000000020
#define pb push_back

typedef long long ll;
typedef pair<ll,ll> pll;

vector<ll>abre;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll n,q,i=1;
    string ans=" ";
    bool ret;

    cin >> n >> q;
    for(i=1;i<=n;i++)
    {
        ans+="(";
    }
    i=1;
    while(i<=n)
    {
        if(abre.empty())
        {
            abre.pb(i);
            i++;
            continue;
        }
        cout << "? " << abre.back() << " " << i << endl;
        fflush(stdout);
        cin >> ret;
        if(ret)
        {
            ans[i]=')';
            abre.pop_back();
        }else
        {
            abre.pb(i);
        }
        i++;
    }
    cout << "!" << ans << endl;
    fflush(stdout);

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 504 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 269 ms 648 KB Output is correct
3 Correct 602 ms 652 KB Output is correct
4 Correct 600 ms 644 KB Output is correct
5 Correct 567 ms 648 KB Output is correct
6 Correct 593 ms 848 KB Output is correct
7 Correct 612 ms 1548 KB Output is correct
8 Correct 537 ms 648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -