제출 #300762

#제출 시각아이디문제언어결과실행 시간메모리
300762IgorI카니발 티켓 (IOI20_tickets)C++17
컴파일 에러
0 ms0 KiB
#include "tickets.h" #include <vector> long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(), m = x[0].size(); vector<long long> s; for (int i = 0; i < n; i++) s.push_back(x[i][0]); sort(all(s)); long long si = 0; for (int i = 0; i < n / 2; i++) si += s[i + n / 2] - s[i]; allocate_tickets(vector<vector<int> >(n, vector<int>(m))); return si; }

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:7:5: error: 'vector' was not declared in this scope
    7 |     vector<long long> s;
      |     ^~~~~~
tickets.cpp:7:5: note: suggested alternatives:
In file included from /usr/include/c++/9/vector:67,
                 from tickets.h:1,
                 from tickets.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note:   'std::vector'
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from tickets.h:1,
                 from tickets.cpp:1:
/usr/include/c++/9/vector:90:13: note:   'std::pmr::vector'
   90 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
tickets.cpp:7:12: error: expected primary-expression before 'long'
    7 |     vector<long long> s;
      |            ^~~~
tickets.cpp:8:33: error: 's' was not declared in this scope
    8 |     for (int i = 0; i < n; i++) s.push_back(x[i][0]);
      |                                 ^
tickets.cpp:9:14: error: 's' was not declared in this scope
    9 |     sort(all(s));
      |              ^
tickets.cpp:9:10: error: 'all' was not declared in this scope
    9 |     sort(all(s));
      |          ^~~
tickets.cpp:9:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |     sort(all(s));
      |     ^~~~
      |     short
tickets.cpp:12:36: error: expected primary-expression before 'int'
   12 |     allocate_tickets(vector<vector<int> >(n, vector<int>(m)));
      |                                    ^~~
tickets.cpp:6:20: warning: unused variable 'm' [-Wunused-variable]
    6 |  int n = x.size(), m = x[0].size();
      |                    ^