Submission #1034296

#TimeUsernameProblemLanguageResultExecution timeMemory
1034296LuvidiZagrade (COI20_zagrade)C++17
100 / 100
586 ms1744 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { int n,q; cin>>n>>q; string ans; for(int i=1;i<=n;i++)ans+='.'; vector<int> v; for(int i=1;i<=n;i++){ v.pb(i); if(v.size()==1)continue; int x=v.size(); cout<<"? "<<v[x-2]<<' '<<v[x-1]<<endl; bool b; cin>>b; if(b){ ans[v[x-2]-1]='('; ans[v[x-1]-1]=')'; v.pop_back(); v.pop_back(); } } for(int i=0;i<v.size()/2;i++)ans[v[i]-1]=')'; for(int i=v.size()/2;i<v.size();i++)ans[v[i]-1]='('; cout<<"! "<<ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }

Compilation message (stderr)

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