제출 #1059207

#제출 시각아이디문제언어결과실행 시간메모리
1059207esomer카니발 티켓 (IOI20_tickets)C++17
27 / 100
324 ms73044 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long find_maximum(int k, vector<vector<int>> x) { int n = (int)x.size(); int m = (int)x[0].size(); vector<vector<int>> ans(n, vector<int>(m, -1)); vector<pair<int, int>> rng(n, {0, m-1}); ll res = 0; for(int r = 0; r < k; r++){ vector<pair<int, int>> v(n); for(int i = 0; i < n; i++){ v[i] = {x[i][rng[i].first] + x[i][rng[i].second], i}; res -= x[i][rng[i].first]; } sort(v.begin(), v.end()); for(int i = n - 1; i >= n/2; i--){ int ind = v[i].second; ans[ind][rng[ind].second] = r; rng[ind].second--; res += v[i].first; } for(int i = 0; i < n/2; i++){ int ind = v[i].second; ans[ind][rng[ind].first] = r; rng[ind].first++; } } allocate_tickets(ans); return res; }
#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...