Submission #640286

#TimeUsernameProblemLanguageResultExecution timeMemory
640286kith14Zagrade (COI20_zagrade)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double #define pairll pair<ll,ll> #define lpairll pair<ll,pairll> #define repp(i,a,b) for (ll i = a; i <= b; i++) #define repz(i,a,b) for (ll i = a; i < b; i++) #define repm(i,a,b) for (ll i = a; i >= b; i--) #define fr first #define sc second #define mp make_pair #define pb push_back const ll N = 1e5+5, MOD = 1e9+7; ll tc = 1, n, m, fnd[N]; ll x, y, k; string s, s1, s2, ye = "YES", no = "NO"; char cr[N]; ll ask(ll l, ll r){ cout << "? " << l << " " << r << endl; cin >> m; return m; } void input(){ cin >> n >> k; } void solve(){ vector<ll> ntbgt; ntbgt.pb(1); cr[1] = '('; repp(i,2,n){ ll a1 = ask(ntbgt.back(),i); if (a1 == 1){ cr[i] = ')'; ntbgt.pop_back(); } else{ cr[i] = '('; ntbgt.pb(i); } } cout << "! "; for (ll i = 1; i <= n; i++){ cout << cr[i]; } cout << endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); //cin >> tc; while(tc--){ input(); solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...