Submission #741128

#TimeUsernameProblemLanguageResultExecution timeMemory
741128PoonYaPatArt Collections (BOI22_art)C++17
100 / 100
1584 ms696 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { vector<int> v,temp; v.push_back(n); for (int i=1; i<=n; ++i) temp.push_back(i); int pre=publish(temp),now,c=0; for (int i=n-1; i>=1; --i) { swap(temp[i-1],temp[n-1]); now=publish(temp); int x=(now-pre+2*c+1)/2; vector<int> h; if (x==0) h.push_back(i); for (int j=0; j<v.size(); ++j) { h.push_back(v[j]); if (j==x-1) h.push_back(i); } swap(h,v); swap(pre,now); c=x; } reverse(v.begin(),v.end()); answer(v); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:19:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for (int j=0; j<v.size(); ++j) {
      |                       ~^~~~~~~~~
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...