Submission #821755

#TimeUsernameProblemLanguageResultExecution timeMemory
821755Darren0724Zagrade (COI20_zagrade)C++17
100 / 100
808 ms1532 KiB
//#pragma GCC optimize("Ofast","O3","unroll-loops") //#pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; //#define double long double #define int long long #define all(x) x.begin(),x.end() #define pii pair<int,int> #define rz resize #define pb emplace_back #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define x first #define y second #define ACorz ios_base::sync_with_stdio(false);cin.tie(0); //#define endl '\n' mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); const int INF=1e9,INF2=2e9; const int mod1=1e9+7; const int mod=998244353; const int N=5005; const int K=45000; const int M=5000; int ask(int a,int b){ cout<<"? "<<a+1<<' '<<b+1<<endl; int p;cin>>p; return p; } int32_t main(){ //ACorz; int n;cin>>n; int q;cin>>q; vector<int> v; string s(n,'0'); for(int i=0;i<n;i++){ if(v.size()==0){ v.push_back(i); continue; } if(ask(v.back(),i)){ s[v.back()]='('; s[i]=')'; v.pop_back(); } else{ v.push_back(i); } } int x=v.size()/2; for(int i=0;i<x;i++){ s[v.back()]='('; v.pop_back(); } for(int i=0;i<x;i++){ s[v.back()]=')'; v.pop_back(); } cout<<"! "<<s<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...