#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
long long find_maximum(int k, vector <vector <int>> x) {
int n=x.size(),m=x[0].size();
int idx[n];
long long res=0;
vector <vector <int>> answer;
answer.resize(n);
for (int i=0;i<n;i++){
idx[i]=0;
answer[i].resize(m,-1);
}
vector <pair <int, int>> v;
for (int j=0;j<k;j++){
for (int i=0;i<n;i++){
res+=x[i].back();
v.emplace_back(x[i].back()+x[i][idx[i]],i);
}
sort(v.begin(),v.end());
for (int i=0;i<n/2;i++){
res-=v[i].first;
answer[v[i].second][idx[v[i].second]]=j;
idx[v[i].second]++;
}
for (int i=n/2;i<n;i++){
x[v[i].second].pop_back();
answer[v[i].second][x[v[i].second].size()]=j;
}
v.clear();
}
allocate_tickets(answer);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
1 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
19 ms |
3248 KB |
Output is correct |
6 |
Correct |
418 ms |
73144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant returned 5 while correct return value is 6. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 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 |
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 |
348 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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
1 ms |
860 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 |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
19 ms |
3248 KB |
Output is correct |
12 |
Correct |
418 ms |
73144 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 |
- |