제출 #302000

#제출 시각아이디문제언어결과실행 시간메모리
302000theStaticMind카니발 티켓 (IOI20_tickets)C++14
27 / 100
827 ms63592 KiB
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()

#include "tickets.h"
#include <vector>

long long find_maximum(int k, std::vector<std::vector<int>> x) {
	int n = x.size();
	int m = x[0].size();
	std::vector<std::vector<int>> answer(n,vector<int> (m, -1));

	vector<int> seq[n];
	vector<int> A;
	int64_t ret = 0;

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			seq[i].push_back(j);
		}
		sort(all(seq[i]), [&](int a, int b){
			return x[i][a] < x[i][b];
		});
		A.push_back(i);
		ret += x[i][seq[i].back()];
	}

	sort(all(A), [&](int a, int b){
		return x[a][seq[a][0]] + x[a][seq[b][m - 1]] < x[b][seq[b][0]] + x[b][seq[b][m - 1]];
	});

	for(int i = 0; i < n/2; i++){
		ret -= x[A[i]][seq[A[i]][0]];
		ret -= x[A[i]][seq[A[i]][m - 1]];
		answer[A[i]][seq[A[i]][0]] = 0;
	}
	for(int i = n / 2; i < n; i++){
		answer[A[i]][seq[A[i]][m - 1]] = 0;
	}
	

	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...