Submission #577803

#TimeUsernameProblemLanguageResultExecution timeMemory
577803Markomafko972Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include "art.h" void solve(int n) { vector<int> v[4005]; int a[4005]; for (int i = 0; i < n; i++) { v[i].clear(); for (int j = 0; j < n; j++) { v[i].push_back((i+j)%n+1); } a[i] = publish(v[i]); } vector<int> sol; for (int i = n-1; i >= 1; i--) { int p = 0, da = 0; for (int j = 0; j < n; j++) { while (p < n && (p <= j || a[p] == -1)) p++; if (p >= n) break; if (a[p]-a[j] == i) { a[j] = -1; sol.push_back(j+1); da = 1; int d = 1; while (j-d >= 0) { if (a[j-d] != -1) a[j-d] -= d; d++; } d = 1; while (j+d < n) { if (a[j+d] != -1) a[j+d] -= i-d+1; d++; } break; } } if (da == 0) { if (a[0]-a[n-1] == i) { a[n-1] = -1; sol.push_back(n); for (int j = n-2; j >= 0; j--) { if (a[j] != -1) a[j] -= (n-1)-j; } } else assert(0); } } for (int i = 0; i < n; i++) { if (a[i] != -1) sol.push_back(i); } answer(sol); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:4:2: error: 'vector' was not declared in this scope
    4 |  vector<int> v[4005];
      |  ^~~~~~
art.cpp:4:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
art.cpp:4:9: error: expected primary-expression before 'int'
    4 |  vector<int> v[4005];
      |         ^~~
art.cpp:7:3: error: 'v' was not declared in this scope
    7 |   v[i].clear();
      |   ^
art.cpp:14:9: error: expected primary-expression before 'int'
   14 |  vector<int> sol;
      |         ^~~
art.cpp:23:5: error: 'sol' was not declared in this scope; did you mean 'solve'?
   23 |     sol.push_back(j+1);
      |     ^~~
      |     solve
art.cpp:45:5: error: 'sol' was not declared in this scope; did you mean 'solve'?
   45 |     sol.push_back(n);
      |     ^~~
      |     solve
art.cpp:51:9: error: 'assert' was not declared in this scope
   51 |    else assert(0);
      |         ^~~~~~
art.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "art.h"
  +++ |+#include <cassert>
    2 | 
art.cpp:56:19: error: 'sol' was not declared in this scope; did you mean 'solve'?
   56 |   if (a[i] != -1) sol.push_back(i);
      |                   ^~~
      |                   solve
art.cpp:58:9: error: 'sol' was not declared in this scope; did you mean 'solve'?
   58 |  answer(sol);
      |         ^~~
      |         solve
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) {
      |        ~~~~~~~~~^~~~