Submission #434216

#TimeUsernameProblemLanguageResultExecution timeMemory
434216ioiCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms588 KiB
#include "tickets.h" #include <vector> #include<bits/stdc++.h> using namespace std ; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size() , m = x[0].size(); vector<vector<int> > ans(n , vector<int> (m , 0)); allocate_tickets(ans); double b = 0 ; vector<int> v; for(int i = 0 ; i < n ; i ++) v.push_back(x[i][0]); sort(v.begin() , v.end()); b = v[n / 2]; long long ret = 0 , mn ; for(int i = 0 ; i < n ; i++)ret += abs(x[i][0] - b); mn = ret ; b = v[n / 2 - 1]; ret = 0 ; for(int i = 0 ; i < n ; i ++)ret += abs(x[i][0] - b); return min(mn , ret); return ret ; /* 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); } allocate_tickets(answer); return 1; */ }
#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...