Submission #1092844

#TimeUsernameProblemLanguageResultExecution timeMemory
1092844juicyArt Collections (BOI22_art)C++17
100 / 100
1010 ms1240 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> a(N), res(N), cnd(N); iota(a.begin(), a.end(), 1); iota(cnd.begin(), cnd.end(), 0); int cur = publish(a), y = 0; for (int i = 0; i + 1 < N; ++i) { rotate(a.begin() + i, a.begin() + i + 1, a.end()); int x = publish(a) - y, d = cur - x; int s = cnd.size() - 1; int hi = (s + d) / 2; cur -= hi; y += hi; res[cnd[hi]] = i + 1; cnd.erase(cnd.begin() + hi); rotate(a.begin() + i, prev(a.end()), a.end()); } res[cnd[0]] = N; answer(res); }

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