제출 #625768

#제출 시각아이디문제언어결과실행 시간메모리
6257681ne카니발 티켓 (IOI20_tickets)C++14
11 / 100
1 ms596 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; #include <vector> long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); long long sum = 0; vector<int>pos; for (int i = 0;i<n;++i){ for (int j = 0;j<m;++j){ sum+=x[i][j]; pos.push_back(x[i][j]); x[i][j] = 0; } } sort(pos.begin(),pos.end()); vector<int>valid = {pos[n/2]}; long long ans = LLONG_MAX; for (auto x:valid){ long long curans = 0; for (auto y:pos){ curans+=abs(y - x); } ans = min(ans,curans); } for (int i = 0;i<n;++i){ for (int j = 0;j<m;++j){ x[i][j] = 0; } } allocate_tickets(x); return ans; }
#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...