Submission #1077348

#TimeUsernameProblemLanguageResultExecution timeMemory
1077348mindiyakCarnival Tickets (IOI20_tickets)C++14
11 / 100
1 ms856 KiB
#include "tickets.h" #include <vector> #include <algorithm> #include <set> using namespace std; typedef long long ll; ll find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); ll val = 1e18; std::vector<std::vector<int>> answer; vector<int> temp; for (int i = 0; i < n; i++) { std::vector<int> row(m,-1); row[0] = 0; temp.push_back(x[i][0]); answer.push_back(row); } sort(temp.begin(),temp.end()); int mid = (n/2)-1; ll midV = temp[mid] + temp[mid+1]; for(int j=0;j<2;j++){ ll cur = 0; for (int i = 0; i < n; i++) cur += abs(((midV+j)/2) - temp[i]); val = min(val,cur); } allocate_tickets(answer); return val; }
#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...