답안 #1015901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015901 2024-07-07T03:36:15 Z warrenn Zagrade (COI20_zagrade) C++14
100 / 100
571 ms 1752 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int n,q;
    cin>>n>>q;

    stack<int>isi;
    char jwb[n+1];

    for(int d=1;d<=n;d++){
        if(isi.empty()){
            isi.push(d);
            jwb[d]='(';
        }
        else{
            cout<<"? "<<isi.top()<<" "<<d<<endl;
            int w;
            cin>>w;
            if(w==0){
                isi.push(d);
                jwb[d]='(';
            }
            else{
                isi.pop();
                jwb[d]=')';
            }
        }
    }

    int ganti=isi.size()/2;
  //  cout<<isi.size()<<endl;
    while(!isi.empty()){
        if(ganti==0){
            jwb[isi.top()]=')';
        }
        else{
            ganti--;
        }
        isi.pop();
    }
    cout<<"! ";
    for(int d=1;d<=n;d++){
        cout<<jwb[d];
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 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 6 ms 428 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 436 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 4 ms 440 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 273 ms 344 KB Output is correct
3 Correct 528 ms 344 KB Output is correct
4 Correct 530 ms 344 KB Output is correct
5 Correct 516 ms 344 KB Output is correct
6 Correct 526 ms 344 KB Output is correct
7 Correct 528 ms 1472 KB Output is correct
8 Correct 502 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 535 ms 1512 KB Output is correct
3 Correct 547 ms 1116 KB Output is correct
4 Correct 500 ms 1752 KB Output is correct
5 Correct 571 ms 1320 KB Output is correct
6 Correct 553 ms 1612 KB Output is correct
7 Correct 518 ms 1008 KB Output is correct
8 Correct 540 ms 592 KB Output is correct