#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long find_maximum(int k, vector<vector<int>> x) {
int n = x.size();
int m = x[0].size();
long long ret = 0;
vector<int> p(n), s(n, m - 1);
vector<vector<int>> answer(n, vector<int> (m, -1));
for (int round = 0; round < k; ++round) {
vector<pair<int, int>> vec;
for (int i = 0; i < n; ++i) {
vec.emplace_back(x[i][p[i]] + x[i][s[i]], i);
}
sort(vec.begin(), vec.end());
for (int i = 0; i < n; ++i) {
int id = vec[i].second;
if (i < n / 2) {
ret -= x[id][p[id]];
answer[id][p[id]] = round;
p[id]++;
} else {
ret += x[id][s[id]];
answer[id][s[id]] = round;
s[id]--;
}
}
}
allocate_tickets(answer);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
16 ms |
2452 KB |
Output is correct |
6 |
Correct |
389 ms |
51488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant returned 5 while correct return value is 6. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant returned 11 while correct return value is 13. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant returned 11 while correct return value is 13. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant returned 11 while correct return value is 13. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
688 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
16 ms |
2452 KB |
Output is correct |
12 |
Correct |
389 ms |
51488 KB |
Output is correct |
13 |
Incorrect |
0 ms |
348 KB |
Contestant returned 5 while correct return value is 6. |
14 |
Halted |
0 ms |
0 KB |
- |