Submission #321169

#TimeUsernameProblemLanguageResultExecution timeMemory
321169blue카니발 티켓 (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include "tickets.h" #include <vector> using namespace std; long long find_maximum(int k, vector< vector<int> > x) { int n = x.size(); vector<int> y(n); for(int i = 0; i < n; i++) y[i] = x[i][0]; sort(y.begin(), y.end()); int b = y[n/2]; long long res = 0; for(int i = 0; i < n; i++) res += abs(b - y[i]); vector< vector<int> > s(n); for(int i = 0; i < n; i++) s[i] = vector<int>(1, 0); allocate_tickets(s); return res; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(y.begin(), y.end());
      |     ^~~~
      |     short
tickets.cpp:14:39: error: 'abs' was not declared in this scope
   14 |     for(int i = 0; i < n; i++) res += abs(b - y[i]);
      |                                       ^~~