Submission #943160

#TimeUsernameProblemLanguageResultExecution timeMemory
943160MilosMilutinovicChameleon's Love (JOI20_chameleon)C++14
4 / 100
7 ms596 KiB
#include "chameleon.h" #include<bits/stdc++.h> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; namespace { int variable_example = 1; } // namespace void Solve(int n){ vector<int> v; vector<pair<int,int>> res; for(int i=1;i<=2*n;i++){ v.pb(i); if(Query(v)!=v.size()){ v.pop_back(); int l=0,r=(int)v.size()-1,p=0; while(l<=r){ int mid=(l+r)/2; vector<int> qv(1,i); for(int j=mid;j<v.size();j++) qv.pb(v[j]); if(Query(qv)!=qv.size()) p=mid,l=mid+1; else r=mid-1; } res.pb(mp(i,v[p])); vector<int> nv; for(int j=0;j<v.size();j++) if(j!=p) nv.pb(v[j]); v=nv; } } for(auto&p:res) Answer(p.fi,p.se); }

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:22:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   if(Query(v)!=v.size()){
      |      ~~~~~~~~^~~~~~~~~~
chameleon.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int j=mid;j<v.size();j++) qv.pb(v[j]);
      |                   ~^~~~~~~~~
chameleon.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(Query(qv)!=qv.size()) p=mid,l=mid+1;
      |        ~~~~~~~~~^~~~~~~~~~~
chameleon.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    for(int j=0;j<v.size();j++) if(j!=p) nv.pb(v[j]);
      |                ~^~~~~~~~~
chameleon.cpp: At global scope:
chameleon.cpp:13:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   13 | int variable_example = 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...
#Verdict Execution timeMemoryGrader output
Fetching results...