제출 #1119930

#제출 시각아이디문제언어결과실행 시간메모리
1119930dsyz카니발 티켓 (IOI20_tickets)C++17
11 / 100
44 ms848 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; using ll = long long; #define MAXN (1000005) long long find_maximum(int k, vector<vector<int>> x) { ll N = x.size(); ll M = x[0].size(); vector<ll> val; for(ll i = 0;i < N;i++){ for(ll j = 0;j < M;j++){ val.push_back(x[i][j]); } } sort(val.begin(),val.end()); pair<ll,ll> mini = {1e18,-1}; for(auto b : val){ ll sum = 0; for(ll i = 0;i < N;i++){ ll maximum = -1e18; for(ll j = 0;j < M;j++){ maximum = max(maximum,abs(b - x[i][j])); } sum += maximum; } mini = min(mini,{sum,b}); } vector<vector<int> > ans; for(ll i = 0;i < N;i++){ vector<int> row; for(ll j = 0;j < M;j++){ row.push_back(-1); } ans.push_back(row); } for(ll i = 0;i < N;i++){ ll maximum = -1e18; ll ind = -1; for(ll j = 0;j < M;j++){ if(maximum <= abs(mini.second - x[i][j])){ maximum = abs(mini.second - x[i][j]); ind = j; } } ans[i][ind] = 0; } allocate_tickets(ans); return mini.first; }
#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...