Submission #1012632

#TimeUsernameProblemLanguageResultExecution timeMemory
1012632pawnedCarnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms860 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;

#include "tickets.h"

ll find_maximum(int K, vector<vector<int>> a_given) {
	int N = a_given.size();
	int M = a_given[0].size();
	vector<vi> a(N, vi(M, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			a[i][j] = a_given[i][j];
		}
	}
	vector<vector<int>> answer(N, vector<int>(M, -1));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (j < K)
				answer[i][j] = j;
		}
	}
	ll minimum = 1e18;
	for (int i = 0; i < N; i++) {
		ll total = 0;
		for (int j = 0; j < N; j++) {
			total += abs(a[j][0] - a[i][0]);
		}
		minimum = min(minimum, total);
	}
	allocate_tickets(answer);
	return minimum;
}
#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...