Submission #1120152

#TimeUsernameProblemLanguageResultExecution timeMemory
1120152vjudge1Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void solve(int n) { vector<int> p; for(int i = 1; i <= n; i++) { p.push_back(i); } int cur = publish(p); vector<int> ans(n, -1); for(int i = 0; i < n - 1; i++) { reverse(p.begin(), p.end()); int d = p.back(); p.pop_back(); reverse(p.begin(), p.end()); p.push_back(d); int cur2 = publish(p); //a - b = cur - cur2; //a + b = n - 1 //2 * a = cur - cur2 + n - 1; int a = (cur - cur2 + n - 1)/2; ans[a] = d; cur = cur2; } int pos = 0; for(int i = 0; i < n; i++) { if(ans[i] == -1) { ans[i] = p[0]; } } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:8:15: error: 'publish' was not declared in this scope
    8 |     int cur = publish(p);
      |               ^~~~~~~
art.cpp:30:5: error: 'answer' was not declared in this scope
   30 |     answer(ans);
      |     ^~~~~~
art.cpp:24:9: warning: unused variable 'pos' [-Wunused-variable]
   24 |     int pos = 0;
      |         ^~~
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) {
      |        ~~~~~~~~~^~~~