Submission #877662

#TimeUsernameProblemLanguageResultExecution timeMemory
877662vjudge1Art Collections (BOI22_art)C++17
100 / 100
1092 ms1804 KiB
#include "art.h" #include <algorithm> using namespace std; void solve(int n) { vector <int> order; for (int i = 1; i <= n; i++) order.push_back(i); int res[n + 1]; for (int i = 0; i < n; i++) { res[i] = publish(order); order.push_back(order[0]); order.erase(order.begin()); } res[n] = res[0]; for (int i = 0; i < n; i++) { // res[i] = z + x // res[i + 1] = z + n - 1 - x // res[i] + res[i + 1] = 2z + n - 1 int z = (res[i] + res[i + 1] - n + 1) / 2; int x = res[i] - z; order[x] = i + 1; } answer(order); }

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