답안 #554287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
554287 2022-04-28T06:31:35 Z leaked Zagrade (COI20_zagrade) C++17
71 / 100
713 ms 716 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,q;
    cin>>n>>q;
    stack<int> st;
    st.push(0);
    auto ask=[&](int l,int r){
        cout<<"? "<<l+1<<' '<<r+1<<endl;
        cout.flush();
        int x;
        cin>>x;
        return x;
    };
    string ans(n,'(');
    for(int i=1;i<n;i++){
        if(sz(st) && ask(st.top(),i)){
            st.pop();ans[i]=')';
        }
        else st.push(i);
    }
    cout<<"! "<<ans;
    cout.flush();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 10 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
8 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 320 ms 400 KB Output is correct
3 Correct 604 ms 400 KB Output is correct
4 Correct 600 ms 400 KB Output is correct
5 Correct 713 ms 396 KB Output is correct
6 Correct 623 ms 396 KB Output is correct
7 Correct 560 ms 716 KB Output is correct
8 Correct 699 ms 404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -