Submission #740076

#TimeUsernameProblemLanguageResultExecution timeMemory
740076vjudge1Fountain Parks (IOI21_parks)C++17
Compilation error
0 ms0 KiB
#include "parks.h" const int maxn = 2e5 + 100; int ord[maxn]; int construct_roads(vector<int>x, vector<int>y) { if (x.size() == 1) { build({}, {}, {}, {}); return 1; } for(int i=0; i<n; i++){ ord[i] = i; } sort(ord, ord+n, [](int a, int b){ return y[a] < y[b]; }); bool ok = 1; vector<int>u, v, a, b; for(int i=1; i<n; i++){ if(y[i]-y[i-1] != 2) ok = 0; u.push_back(ord[i-1]); v.push_back(ord[i]); a.push_back(1); b.push_back(y[ord[i]]-1); } if(ok) build(u, v, a, b); return ok; }

Compilation message (stderr)

parks.cpp:5:21: error: 'int construct_roads' redeclared as different kind of entity
    5 | int construct_roads(vector<int>x, vector<int>y) {
      |                     ^~~~~~
In file included from parks.cpp:1:
parks.h:3:5: note: previous declaration 'int construct_roads(std::vector<int>, std::vector<int>)'
    3 | int construct_roads(std::vector<int> x, std::vector<int> y);
      |     ^~~~~~~~~~~~~~~
parks.cpp:5:21: error: 'vector' was not declared in this scope
    5 | int construct_roads(vector<int>x, vector<int>y) {
      |                     ^~~~~~
parks.cpp:5:21: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from parks.h:1,
                 from parks.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 parks.h:1,
                 from parks.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
parks.cpp:5:28: error: expected primary-expression before 'int'
    5 | int construct_roads(vector<int>x, vector<int>y) {
      |                            ^~~
parks.cpp:5:35: error: 'vector' was not declared in this scope
    5 | int construct_roads(vector<int>x, vector<int>y) {
      |                                   ^~~~~~
parks.cpp:5:35: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from parks.h:1,
                 from parks.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 parks.h:1,
                 from parks.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
parks.cpp:5:42: error: expected primary-expression before 'int'
    5 | int construct_roads(vector<int>x, vector<int>y) {
      |                                          ^~~