Submission #580179

#TimeUsernameProblemLanguageResultExecution timeMemory
580179penguinhackerArt Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array void solve(int n) { vector<int> a(n), ans(n, -1); iota(a.begin(), a.end(), 1); int last=publish(a); for (int i=1; i<=n-1; ++i) { a.erase(a.begin()); a.insert(a.begin()+n-i, i); int cur=publish(a); int bigger=(last-cur)+(n-i); // how many elements is p_i greater than {p_i+1, p_i+2, ... , p_n} assert(bigger%2==0); bigger/=2; for (int j=0; j<n; ++j) { if (ans[j]!=-1) continue; if (bigger==0) { ans[j]=i; break; } --bigger; } last=cur; } for (int i=0; i<n; ++i) if (ans[i]==-1) ans[i]=n; answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:10:11: error: 'publish' was not declared in this scope
   10 |  int last=publish(a);
      |           ^~~~~~~
art.cpp:32:2: error: 'answer' was not declared in this scope
   32 |  answer(ans);
      |  ^~~~~~
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) {
      |        ~~~~~~~~~^~~~