Submission #307050

#TimeUsernameProblemLanguageResultExecution timeMemory
307050rqiCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms768 KiB
#include "tickets.h"
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pi;
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef vector<pl> vpl;

#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define mp make_pair
#define f first
#define s second

long long find_maximum(int k, vector<vi> x) {
	int n = sz(x);
	int m = sz(x[0]);
	vector<vi> answer;
	for(int i = 0; i < n; i++){
		answer.pb(vi(m, -1));
	}
	ll ans = 0;
	if(k == m){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				answer[i][j] = j;
			}
		}
		for(int j = 0; j < k; j++){
			vl nums;
			for(int i = 0; i < n; i++){
				nums.pb(x[i][j]);
			}
			sort(all(nums));
			for(int i = 0; i < n; i++){
				if(i < n/2){
					ans-=nums[i];
				}
				else{
					ans+=nums[i];
				}
			}
		}
	}
	allocate_tickets(answer);
	return ans;
}
#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...