Submission #637063

#TimeUsernameProblemLanguageResultExecution timeMemory
637063GrandTiger1729Art Collections (BOI22_art)C++17
100 / 100
1682 ms700 KiB
#include <iostream> #include <vector> #include <numeric> using namespace std; int publish(vector<int> R); void answer(vector<int> R); void solve(int n){ vector<int> ans(n); iota(ans.begin(), ans.end(), 1); int i = 1, cur = publish(ans); while (cur > 0){ vector<int> tmp(ans); tmp.erase(tmp.begin() + i); tmp.insert(tmp.begin(), ans[i]); int re = publish(tmp); int x = (re - cur + i) / 2; ans.erase(ans.begin() + i); ans.insert(ans.begin() + x, tmp[0]); cur -= i - x; i++; } answer(ans); }

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...