Submission #693976

#TimeUsernameProblemLanguageResultExecution timeMemory
693976finn__Art Collections (BOI22_art)C++17
100 / 100
1634 ms752 KiB
#include <bits/stdc++.h> using namespace std; #include "art.h" void cyclic_shift(vector<int> &p) { int x = p.back(); for (int i = 0; i < p.size(); i++) swap(x, p[i]); } int get_index(vector<int> const &x, int i) { i = x.size() - i - 1; return (x.size() + x[(i + 1) % x.size()] - x[i] - 1) / 2; } void solve(int N) { vector<int> p(N); for (int i = 0; i < N; i++) p[i] = i + 1; vector<int> x(N); for (int i = 0; i < N; i++) { x[i] = publish(p); cyclic_shift(p); } for (int i = 0; i < N; i++) p[get_index(x, i)] = i + 1; answer(p); }

Compilation message (stderr)

art.cpp: In function 'void cyclic_shift(std::vector<int>&)':
art.cpp:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < p.size(); i++)
      |                     ~~^~~~~~~~~~
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...