Submission #849514

# Submission time Handle Problem Language Result Execution time Memory
849514 2023-09-14T22:58:24 Z IBory Carnival Tickets (IOI20_tickets) C++17
27 / 100
399 ms 73152 KB
#include "tickets.h"
#include <bits/stdc++.h>
#define pii pair<ll, ll>
typedef long long ll;
using namespace std;

const int MAX = 1505;
int L[MAX], R[MAX];

ll find_maximum(int K, vector<vector<int>> X) {
	int N = X.size();
	int M = X[0].size();
	ll ans = 0;
	vector<vector<int>> used;
	for (int i = 0; i < N; ++i) {
		vector<int> go(M, -1);
		used.push_back(go);
	}

	fill(R, R + N, M - 1);
	for (int k = 0; k < K; ++k) {
		vector<pii> T;
		ll init = 0;
		for (int i = 0; i < N; ++i) {
			init += X[i][R[i]];
			T.emplace_back(-X[i][L[i]] - X[i][R[i]], i);
		}
		sort(T.begin(), T.end(), greater<pii>());
		for (int i = 0; i < N / 2; ++i) {
			auto [v, id] = T[i];
			init += v;
			used[id][L[id]++] = k;
		}
		for (int i = N / 2; i < N; ++i) {
			auto [_, id] = T[i];
			used[id][R[id]--] = k;
		}
		ans += init;
	}

	allocate_tickets(used);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 17 ms 3160 KB Output is correct
6 Correct 397 ms 73152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 15 ms 2648 KB Output is correct
6 Correct 399 ms 57128 KB Output is correct
7 Correct 397 ms 57208 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 344 KB Contestant returned 43 while correct return value is 45.
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 17 ms 3160 KB Output is correct
12 Correct 397 ms 73152 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 15 ms 2648 KB Output is correct
18 Correct 399 ms 57128 KB Output is correct
19 Correct 397 ms 57208 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Incorrect 1 ms 344 KB Contestant returned 43 while correct return value is 45.
23 Halted 0 ms 0 KB -