Submission #1213327

#TimeUsernameProblemLanguageResultExecution timeMemory
1213327Ahmed_KaanicheZagrade (COI20_zagrade)C++20
71 / 100
230 ms1296 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define fi first #define se second #define pb push_back signed main() { //the boost // ios_base::sync_with_stdio(false); // cin.tie(nullptr); // cout.tie(nullptr); //main code ll n, q; cin >> n >> q; vector<char> s(n+1, '.'); s[1] = '('; s[n] = ')'; vector<ll> prev(n+1, -1); ll curr=1; for (ll i = 2; i < n; ++i) { bool v; cout << "? " << curr << ' ' << i << endl; cout.flush(); cin >> v; if(v){ s[i]=')'; if(prev[curr]==-1){ s[i+1]='('; i++; } else{ curr=prev[curr]; } } else{ s[i]='('; prev[i]=curr; curr=i; } } cout << "! "; for (ll i = 1; i <= n; ++i) { cout << s[i]; } cout << endl; cout.flush(); 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...