Submission #301835

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3018352020-09-18 08:41:30majkCarnival Tickets (IOI20_tickets)C++17
100 / 100
973 ms62360 KiB
#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) {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...