Submission #854379

#TimeUsernameProblemLanguageResultExecution timeMemory
854379vjudge1Art Collections (BOI22_art)C++17
100 / 100
1562 ms1900 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> order(N); for(int i = 0; i < N; i++) order[i] = i + 1; int lst = publish(order); int fst = lst; vector<int> ans(N); for(int i = 0; i < N; i++){ reverse(order.begin(), order.end()); int elem = order.back(); order.pop_back(); reverse(order.begin(), order.end()); order.push_back(elem); int nw; if(order[0] == 1) nw = fst; else nw = publish(order); int dif = nw - lst; lst = nw; ans[order[N - 1] - 1] = (N - dif + 1) / 2; // cout << "rank " << ans[order[0] - 1] << " nw " << nw << " lst " << lst2 << endl; } vector<int> real_ans(N); for(int i = 0; i < N; i++){ real_ans[ans[i]-1] = i + 1; } answer(real_ans); } /* 10 9 10 3 1 2 4 8 7 6 5 */

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