Submission #623864

#TimeUsernameProblemLanguageResultExecution timeMemory
623864AlmaArt Collections (BOI22_art)C++17
100 / 100
1591 ms740 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second using ll = long long; using ii = pair<int,int>; const int INF = 1e9; const ll LLINF = 1e18; using vi = vector<int>; using vvi = vector<vi>; // prev: K // act - prev: RES = (K-i) + (N-1 - i) - K = N-2i-1 // i = (N - RES - 1) / 2 void solve (int N) { vi vec(N), res(N), ans(N); for (int i = 0; i < N; i++) { vec[i] = i+1; } for (int i = 0; i < N; i++) { res[i] = publish(vec); rotate(vec.begin(), vec.begin()+1, vec.end()); } for (int i = 0; i < N; i++) { int pos = (N - res[(i+1) % N] + res[i] - 1) / 2; ans[pos] = i+1; } 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...