Submission #613244

#TimeUsernameProblemLanguageResultExecution timeMemory
613244ajpianoKing of Chairs (FXCUP4_chairs)C++17
Compilation error
0 ms0 KiB
#include "king.h" long long SendInfo(vector<int> W, vector<int> C){ return 0; }
#include <bits/stdc++.h> #include "vassal.h" using namespace std; set<pair<int,int>> chairs; //weight index void Init(int B, vector<int> c){ int n = c.size(); for(int i = 0; i < n; i++){ chairs.insert({c[i],i}); } } int Maid(int w){ auto it = chairs.lower_bound({w,0}); if(it == chairs.end()) return -1; else{ int ans = it->second; chairs.erase(it); return ans; } }

Compilation message (stderr)

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

/usr/bin/ld: /tmp/ccKlAXdp.o: in function `main':
grader_v.cpp:(.text.startup+0x1ca): undefined reference to `Init(long long, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status