Submission #464101

#TimeUsernameProblemLanguageResultExecution timeMemory
464101armandCarnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms204 KiB
#include "tickets.h" #include <vector> #include <algorithm> using namespace std; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); int i, j, p; long long res = 0; int b; std::vector<std::vector<int>> answer; vector<int> a(n); for (i = 0; i < n; i++) { std::vector<int> row(m); for (j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); for (j = n-1, p = 0; p<k && j>=0; j++,p++) { for (i = 0; i < n; i++) a[i] = x[i][j]; sort(a.begin(), a.end()); b = a[n / 2]; for (i = 0; i < n; i++) res += i >= n / 2 ? a[i] : -a[i]; } return res; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:11:6: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   11 |  int b;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...