Submission #1032900

#TimeUsernameProblemLanguageResultExecution timeMemory
1032900ZicrusCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; typedef long long ll; ll find_maximum(int k, vector<vector<int>> x) { vector<int> s(x.size()); for (int i = 0; i < x.size(); i++) s[i] = x[i][0]; sort(s.begin(), s.end()); ll median = s[s.size() / 2]; ll sum = 0; for (auto &e : s) sum += abs(e - median); allocate_tickets(vector<vector<int>>(n, vector<int>(1))); return sum; }

Compilation message (stderr)

tickets.cpp: In function 'll find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i = 0; i < x.size(); i++) s[i] = x[i][0];
      |                     ~~^~~~~~~~~~
tickets.cpp:14:42: error: 'n' was not declared in this scope
   14 |     allocate_tickets(vector<vector<int>>(n, vector<int>(1)));
      |                                          ^