Submission #647342

#TimeUsernameProblemLanguageResultExecution timeMemory
647342PetyArt Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int INF = 1e9; const int MOD = 1e9 + 7; void solve(int N) { vector<int>R; for (int i = 1; i <= N; i++) R.push_back(i); int value = publish(R); vector<int>ans = {1}; for (int i = 2; i <= n; i++) { vector<int>R2 = {i}; for (int j = 1; j <= N; j++) if (j != i) { R2.push_back(j); } int value2 = publish(R2); ///x + y = i - 1 ///x - y = value - value2 ///x-->alea mai jos, y-->alea mai sus int x = (i - 1 + value - value2) / 2; int y = i - 1 - x; ans.push_back(0); for (int j = ans.size() - 2; j >= y; j--) ans[j + 1] = ans[j]; ans[y] = i; } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:13:15: error: 'publish' was not declared in this scope
   13 |   int value = publish(R);
      |               ^~~~~~~
art.cpp:15:24: error: 'n' was not declared in this scope
   15 |   for (int i = 2; i <= n; i++) {
      |                        ^
art.cpp:32:3: 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) {
      |        ~~~~~~~~~^~~~