답안 #1099110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099110 2024-10-10T15:01:33 Z lomta Zagrade (COI20_zagrade) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=100005;

int arr[MAXN],hel;
int quest(int a,int b){

    cout<<"?"<<" "<< a<<" "<<b<<endl;
    int x;cin>>x;
    return x;

}
int main(){
    int n,m;cin>>n>>m;
    string s;
    for(int i=1;i<=n;i++){
        s=s+' ';

        if(hel==0 || !quest(arr[hel],i)){
            arr[++hel]=i;
        }
        else{
            s[arr[hel--]-1]='(';
            s[i-1]=')';
        }

    }

    for(int i=1;i<=hel/2;i++){
        s[arr[i]-1]=')';
    }
    for(int i=top/2+1;i<=hel;i++){
        s[arr[i]-1]='(';
    }

    cout<< " ! " <<s;

}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:33:15: error: 'top' was not declared in this scope
   33 |     for(int i=top/2+1;i<=hel;i++){
      |               ^~~