제출 #886377

#제출 시각아이디문제언어결과실행 시간메모리
886377NeroZein카니발 티켓 (IOI20_tickets)C++17
27 / 100
395 ms73208 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); long long ret = 0; vector<int> p(n), s(n, m - 1); for (int round = 0; round < k; ++round) { vector<pair<int, int>> vec; for (int i = 0; i < n; ++i) { vec.emplace_back(x[i][p[i]] + x[i][s[i]], i); } sort(vec.begin(), vec.end()); for (int i = 0; i < n; ++i) { int id = vec[i].second; if (i < n / 2) { ret -= x[id][p[id]]; p[id]++; } else { ret += x[id][s[id]]; s[id]--; } } } vector<vector<int>> answer; for (int i = 0; i < n; i++) { vector<int> row(m, -1); for (int j = 0; j < m; j++) { if (j < p[i] || j > s[i]) { row[j] = 0; } } answer.push_back(row); } allocate_tickets(answer); return ret; }
#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...