제출 #1029605

#제출 시각아이디문제언어결과실행 시간메모리
1029605happy_node카니발 티켓 (IOI20_tickets)C++17
0 / 100
0 ms348 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long find_maximum(int k, std::vector<std::vector<int>> d) { int N=d.size(); int M=d[0].size(); vector<int> ord; for(int i=0;i<N;i++) ord.push_back(i); sort(ord.begin(),ord.end(),[&](int i, int j) { return d[i]<d[j]; }); vector<vector<int>> s(N,vector<int>(M,-1)); vector<pair<int,int>> vals; for(int j=0;j<M;j++) { int s=0; for(int i=0;i<N/2;i++) s+=d[ord[i]][j]; for(int i=N/2;i<N;i++) s+=d[ord[i]][M-j-1]; s=min(s,N-s); vals.push_back({s,j}); } sort(vals.rbegin(),vals.rend()); ll ans=0; for(int j=0;j<k;j++) { ans+=vals[j].first; for(int i=0;i<N/2;i++) s[ord[i]][vals[j].second]=j; for(int i=N/2;i<N;i++) s[ord[i]][M-vals[j].second-1]=j; } allocate_tickets(s); 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...