제출 #301204

#제출 시각아이디문제언어결과실행 시간메모리
301204IgorI카니발 티켓 (IOI20_tickets)C++17
27 / 100
946 ms51424 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(), m = x[0].size(); vector<vector<int> > ans(n, vector<int>(m, -1)); vector<pair<long long, pair<int, int> > > moo; long long res = 0; for (int e = 0; e < k; e++) { for (int i = 0; i < n; i++) { ans[i][e] = e; res -= x[i][e]; moo.push_back({x[i][e] + x[i][e + m - k], {i, e}}); } } sort(moo.begin(), moo.end()); reverse(moo.begin(), moo.end()); for (int i = 0; i < n / 2 * k; i++) { int a = moo[i].second.first; int b = moo[i].second.second; res += moo[i].first; int z = ans[a][b]; ans[a][b] = -1; ans[a][b + m - k] = z; } 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...