#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();
vector<vector<int>> answer;
long long s=0;
if(k==1){
answer.resize(n,vector<int>());
for(int i=0;i<n;i++) for(int j = 0; j < m; j++) answer[i].push_back(-1);
vector<pair<int,int>> mini;
for(int i=0;i<n;i++) mini.push_back({x[i][m-1]+x[i][0],i});
sort(mini.begin(),mini.end());
for(int i=0;i<n;i++){
if(i<n/2){
s-=x[mini[i].second][0];
answer[mini[i].second][0]=0;
}
else{
s+=x[mini[i].second][m-1];
answer[mini[i].second][m-1]=0;
}
}
}
allocate_tickets(answer);
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
33 ms |
2688 KB |
Output is correct |
6 |
Correct |
817 ms |
54684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: allocate_tickets called with parameter of wrong size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: allocate_tickets called with parameter of wrong size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: allocate_tickets called with parameter of wrong size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: allocate_tickets called with parameter of wrong size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
768 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
1 ms |
256 KB |
Output is correct |
10 |
Correct |
3 ms |
512 KB |
Output is correct |
11 |
Correct |
33 ms |
2688 KB |
Output is correct |
12 |
Correct |
817 ms |
54684 KB |
Output is correct |
13 |
Incorrect |
1 ms |
256 KB |
WA in grader: allocate_tickets called with parameter of wrong size |
14 |
Halted |
0 ms |
0 KB |
- |