제출 #1365347

#제출 시각아이디문제언어결과실행 시간메모리
1365347ChocoZagrade (COI20_zagrade)C++20
14 / 100
201 ms828 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll  int
#define fori(i,j,k) for(ll i=j; i<=k;i++)
#define study ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define all(s) s.begin(),s.end()
const ll sz=2e5+10;
ll INF=1;
ll mod=1e9+7;
ll limit=1;
void work(){
    ll n,q;
    cin>>n>>q;
    vector<ll>v(n+10,-1);
    fori(i,1,n){
        if(v[i]!=-1)
        continue;
        for(ll j=i+1;j<=n;j+=2){
            cout<<"? "<<i<<" "<<j<<endl;
            cout.flush();
            ll x;
            cin>>x;
            if(x==1){
                v[i]=0;
                v[j]=1;
                break;
            }
        }
    }
    cout<<"! ";
    fori(i,1,n){
        if(v[i]==0)
        cout<<"(";
        else
        cout<<")";
    }
    cout.flush();
}
int main()
{
    // #ifndef LOCAL
    // freopen("snowcow.in","r",stdin);
    // freopen("snowcow.out","w",stdout);
    // #endif
    study;
    ll t=1;
    //cin>>t;
    fori(i,1,t){
    work();
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…