Submission #677865

#TimeUsernameProblemLanguageResultExecution timeMemory
677865jamezzzArt Collections (BOI22_art)C++17
100 / 100
1547 ms724 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N){ vector<int> v; for(int i=1;i<=N;++i)v.push_back(i); int cost=publish(v); vector<int> ans={1}; for(int i=2;i<=N;++i){ vector<int> v={i}; for(int j=1;j<=N;++j){ if(i!=j)v.push_back(j); } int newcost=publish(v); int diff=newcost-cost; int small=(i+diff)/2; vector<int> newans; for(int j=0;j<small;++j)newans.push_back(ans[j]); newans.push_back(i); for(int j=small;j<ans.size();++j)newans.push_back(ans[j]); swap(newans,ans); newans.clear(); } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int j=small;j<ans.size();++j)newans.push_back(ans[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...