Submission #1114417

#TimeUsernameProblemLanguageResultExecution timeMemory
1114417MrAndriaZagrade (COI20_zagrade)C++14
100 / 100
1951 ms1612 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back //#define int long long int n,q; char c[1000005]; vector <int> v; bool b1; bool query(int l,int r){ cout<<"? "<<l<<" "<<r<<endl; bool b2; cin>>b2; return b2; } int main(){ cin>>n>>q; // v.pb(1\); for(int i=1;i<=n;i++){ v.pb(i); if(v.size()<2){ continue; } b1=query(v[v.size()-2],v[v.size()-1]); if(b1){ c[v[v.size()-2]]='('; c[v[v.size()-1]]=')'; v.pop_back(); v.pop_back(); } } if(v.size()){ for(int i=1;i<=v.size();i++){ if(2*i<=(v.size())){ c[v[i-1]]=')'; }else{ c[v[i-1]]='('; } } cout<<"! "; for(int i=1;i<=n;i++){ cout<<c[i]; } cout<<endl; }else{ cout<<"! "; for(int i=1;i<=n;i++){ cout<<c[i]; } cout<<endl; } }

Compilation message (stderr)

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