Submission #917591

#TimeUsernameProblemLanguageResultExecution timeMemory
917591PotatoManZagrade (COI20_zagrade)C++14
71 / 100
502 ms1708 KiB
#include <bits/stdc++.h> #define inf INT_MAX #define longlonginf LONG_LONG_MAX #define mod 998244353 #define MAXN 200005 #define pii pair<ll,ll> #define ll long long #define deb(x) cerr<<"[ "<<#x<<" = "<<x<<" ]"; #define yes() cout<<"YES\n"; #define no() cout<<"NO\n"; using namespace std; ll n,k,m,q,cur,z; ll ans = 0; string subtask; void solve(){ cin>>n>>q; ll rem = n/2; stack<int> s; string res = string(n,'.'); for(int i = 1 ; i <= n ; i++){ if( s.empty() ) { s.push(i); continue; } cout<<"? "<<s.top()<<" "<<i<<endl; cin>>k; if(k){ res[s.top()-1] = '('; res[i-1] = ')'; s.pop(); rem--; } else{ s.push(i); } } for(int i = 0 ; i < rem/2 ; i++) { res[s.top()] = ')'; s.pop(); } for(int i = 0 ; i < rem/2 ; i++) { res[s.top()] = '('; s.pop(); } cout<<"! "<<res<<endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T = 1; //cin>>T; for(int i = 0 ; i < T ; i++){ //cout<<"Case #"<<i+1<<": "; solve(); } return 0; } /* out of bound for loop (constraint change in loop) forget to change bool to int misread -> missed subtask you thought u declared it huh? not i but x logical operator wrong example/proof thoroughly wrong variables thinking it wrong bruh just try some test case capitals ;-; wrong data structure lol count memory usement corner case oversized array orders statements size initializer while con map -> array wrong digits?? swapped variables?? check if theres any variabled that got declared twice find some pattern name collision constraints??! mod !! resets */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...