Submission #652068

#TimeUsernameProblemLanguageResultExecution timeMemory
652068mychecksedadCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms300 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin(), x.end()

void allocate_tickets(vector<vector<int>> _x);

long long find_maximum(int k, vector<vector<int>> arr) {
	int n = arr.size();
	int m = arr[0].size();
	vector<vector<int>> answer;
	vector<pair<ll, int>> a;

	for (int i = 0; i < n; i++) {
		std::vector<int> row(m, -1);
		answer.push_back(row);
		a.pb({arr[i][0] + arr[i][m - 1], i});
	}
	sort(all(a));
	ll ans = 0;

	for(int i = 0; i < n/2; ++i){
		int x = a[n - i - 1].second, y = a[i].second;
		ans += arr[x][1] - arr[y][0];
		answer[x][m - 1] = 0;
		answer[y][0] = 0;
	}

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