# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301835 | majk | Carnival Tickets (IOI20_tickets) | C++17 | 973 ms | 62360 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
#include <algorithm>
#include "tickets.h"
using namespace std;
#define x first
#define y second
typedef std::pair<int,int> pii; typedef long long ll;
template<typename T>class vector2:public vector<vector<T>>{public:vector2(){} vector2(size_t a,size_t b,T t=T()):vector<vector<T>>(a,vector<T>(b,t)){}};
ll find_maximum(int K, vector<vector<int>> A) {
int N = A.size(), M = A[0].size();
ll tot = 0;
vector<pii> S;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < K; ++j) {
tot += A[i][j+M-K];
S.push_back({A[i][j] + A[i][j+M-K], i});
}
}
sort(S.begin(),S.end());
vector<int> CntLo(N, 0), CntHi(N);
for (int i = 0; i < N*K/2; ++i) {
tot -= S[i].x;
CntLo[S[i].y]++;
}
for (int i = 0; i < N; ++i) CntHi[i] = K - CntLo[i];
vector2<int> T(N, M, -1);
for (int i = 0; i < K; ++i) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |