#include "tickets.h"
#include <bits/stdc++.h>
#define va first
#define vb second
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
const int MN = 1505;
const int MOD = 1e9+7;
const int INF = 1e9;
vector<int> T;
int a[MN],s[MN];
bool cmp(int x, int y)
{
return s[x]<s[y];
}
ll find_maximum(int k, vector<vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<vector<int>> ans;
for(int i=0; i<n; i++) a[i] = i;
for(int i=0; i<n; i++) s[i] = x[i][m-1]+x[i][0];
sort(a,a+n,cmp);
vector<int> row(m,-1);
for(int i=0; i<n; i++){
ans.push_back(row);
}
for(int i=0; i<n; i++){
if(i<n/2){
ans[a[i]][0] = 0;
T.push_back(x[a[i]][0]);
}
else{
ans[a[i]][m-1] = 0;
T.push_back(x[a[i]][m-1]);
}
}
ll sum = 0;
sort(all(T));
for(int i=0; i<n; i++){
if(i<n/2) sum -= T[i];
else sum += T[i];
}
allocate_tickets(ans);
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
47 ms |
2424 KB |
Output is correct |
6 |
Correct |
814 ms |
51492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
There is no ticket of color 0 on day 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
There is no ticket of color 0 on day 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
There is no ticket of color 0 on day 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
There is no ticket of color 0 on day 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
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 |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
512 KB |
Output is correct |
11 |
Correct |
47 ms |
2424 KB |
Output is correct |
12 |
Correct |
814 ms |
51492 KB |
Output is correct |
13 |
Incorrect |
1 ms |
384 KB |
There is no ticket of color 0 on day 1 |
14 |
Halted |
0 ms |
0 KB |
- |