Submission #1033108

#TimeUsernameProblemLanguageResultExecution timeMemory
1033108Marco_EscandonCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms604 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #include "tickets.h" long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); std::vector<std::vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } sort(x.begin(),x.end()); ll ac=(x[(n-1)/2][0]+x[n/2][0])/2; ll bs=1e17;ll c=0; for(int j=ac-2; j<ac+3; j++) { ll t1=0; for(int i=0; i<n; i++) { t1+=abs(x[i][0]-j); } bs=min(bs,t1); } allocate_tickets(answer); return bs; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:22:16: warning: unused variable 'c' [-Wunused-variable]
   22 |  ll bs=1e17;ll c=0;
      |                ^
#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...