Submission #776211

#TimeUsernameProblemLanguageResultExecution timeMemory
776211rxlfd314Art Collections (BOI22_art)C++17
100 / 100
1291 ms572 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> ans(N); iota(ans.begin(), ans.end(), 1); int cur = publish(ans); for (int i = 1; i < N; i++) { reverse(ans.begin(), ans.begin()+i+1); int nxt = publish(ans); int v = cur - nxt + i*(i-1)/2 + i >> 1; reverse(ans.begin(), ans.begin()+i+1); for (int j = i; j > i-v; j--) { swap(ans[j], ans[j-1]); } cur -= v; } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:12:33: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |   int v = cur - nxt + i*(i-1)/2 + i >> 1;
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~
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...