Submission #865243

#TimeUsernameProblemLanguageResultExecution timeMemory
865243sleepntsheepArt Collections (BOI22_art)C++17
0 / 100
0 ms344 KiB
#include "art.h" #include<bits/stdc++.h> void solve(int N){std::vector<int>o(N),r(N,-1);int i,c=1,l=-1,d;for(;c<N;++c){d=l;if(l+1){auto it=std::find(o.begin(),o.end(),c+1);std::swap(o[1],*it);std::swap(o[0],*std::find(o.begin(),o.end(),c));d=publish(o);}o.erase(o.begin());o.push_back(c);l=publish(o);d-=l;r[(N-1+d)/2]=c++;}for(i=0;i++<N;)if(std::find(r.begin(),r.end(),i)==r.end())*std::find(r.begin(),r.end(),-1)=i;answer(r); }

Compilation message (stderr)

interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...