제출 #1057085

#제출 시각아이디문제언어결과실행 시간메모리
1057085aufan카니발 티켓 (IOI20_tickets)C++17
27 / 100
275 ms51320 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> a) { int n = (int)a.size(), m = (int)a[0].size(); long long res = 0; vector<int> pl(n), pr(n, m - 1); vector<vector<int>> ans(n, vector<int>(m, -1)); for (int i = 0; i < k; i++) { vector<pair<int, int>> v; for (int j = 0; j < n; j++) { res -= a[j][pl[j]]; v.push_back({a[j][pr[j]] + a[j][pl[j]], j}); } sort(v.begin(), v.end()); for (int j = 0; j < n / 2; j++) { auto [x, p] = v[j]; ans[p][pl[p]++] = i; } for (int j = n / 2; j < n; j++) { auto [x, p] = v[j]; res += x; ans[p][pr[p]--] = i; } } 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...