Submission #641598

#TimeUsernameProblemLanguageResultExecution timeMemory
641598christinelynnZagrade (COI20_zagrade)C++17
100 / 100
882 ms1064 KiB
#include <bits/stdc++.h> #define bupol __builtin_popcount #define ll long long #define fi first #define se second #define pb push_back #define pu push using namespace std; const ll MAXN = 4e5+10; const ll MAXS = 4010; const ll INF = 1e9; const ll MOD = 998244353; const ll LOG = 60; typedef pair<ll,ll> pii; typedef pair<pii,ll> ipii; vector <int> v; char ans[MAXN]; int que(int x, int y){ cout << "? " << x << ' ' << y << endl; int te; cin >> te; return te; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, q; cin >> n >> q; for(int i=1; i<=n; i++){ if(v.empty()){ v.pb(i); continue; } v.pb(i); int siz = v.size()-1; int te = que(v[siz-1], v[siz]); if(te==1){ ans[v[siz-1]] = '('; ans[v[siz]] = ')'; v.pop_back(); v.pop_back(); } } for(int i=0; i<v.size()/2; i++) ans[v[i]] = ')'; for(int i=v.size()/2; i<v.size(); i++) ans[v[i]] = '('; cout << "! "; for(int i=1; i<=n; i++) cout << ans[i]; cout << endl; }

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:41:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i=0; i<v.size()/2; i++) ans[v[i]] = ')';
      |                  ~^~~~~~~~~~~
zagrade.cpp:42:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i=v.size()/2; i<v.size(); i++) ans[v[i]] = '(';
      |                           ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...