답안 #774176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
774176 2023-07-05T12:32:48 Z vjudge1 Zagrade (COI20_zagrade) C++17
100 / 100
856 ms 1508 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 10000000005
#define mod 1000000007
char dizi[100005];
vector <int> q;

int sor(int x,int y){
    cout<<"? "<<x<<" "<<y<<" ";
    cout<<'\n';
    int m;cin>>m;
    cout<<'\n';
    return m;
}

int32_t main(){
    int n,k;cin>>n>>k;
    dizi[1]='(';
    q.push_back(1);
    for(int i=2;i<=n;i++){
        if(q.size() && sor(q.back(),i)){
            dizi[i]=')';
            q.pop_back();
        }
        else{
            dizi[i]='(';
            q.push_back(i);
        }
    }
    int gec=q.size()/2;
    //cout<<"ft"<<gec<<endl;
    for(int i=0;i<gec;i++){
        dizi[q[i]]=')';
    }
    cout<<"! ";
    for(int i=1;i<=n;i++)cout<<dizi[i]<<"";
    cout<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 10 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct
8 Correct 8 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 8 ms 308 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 12 ms 320 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 417 ms 356 KB Output is correct
3 Correct 710 ms 372 KB Output is correct
4 Correct 566 ms 344 KB Output is correct
5 Correct 765 ms 352 KB Output is correct
6 Correct 856 ms 360 KB Output is correct
7 Correct 438 ms 960 KB Output is correct
8 Correct 727 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 694 ms 1508 KB Output is correct
3 Correct 504 ms 888 KB Output is correct
4 Correct 476 ms 1224 KB Output is correct
5 Correct 611 ms 896 KB Output is correct
6 Correct 674 ms 1040 KB Output is correct
7 Correct 733 ms 756 KB Output is correct
8 Correct 837 ms 468 KB Output is correct