# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
399981 | faresbasbs | Carnival Tickets (IOI20_tickets) | C++14 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "tickets.h"
using namespace std;
int n,m,l[1501],r[1501];
long long find_maximum(int k, vector<vector<int>> x){
n = x.size() , m = x[0].size();
vector<pair<long long,long long>> v,vals;
for(int i = 0 ; i < n ; i += 1){
l[i] = 0 , r[i] = m-1;
vals.push_back({0,i});
for(int j = 0 ; j < m ; j += 1){
v.push_back({x[i][j],i});
}
}
sort(v.begin(),v.end());
vector<vector<int>> ans(n,vector<int>(m,-1));
long long ret = 0;
for(int i = 0 ; i < v.size()/2 ; i += 1){
ret -= v[i].first;
}
for(int i = v.size()/2 ; i < v.size() ; i += 1){
ret += v[i].first;
vals[v[i].second].first += 1;
}
for(int i = 0 ; i < k ; i += 1){
sort(vals.begin(),vals.end());
for(int j = 0 ; j < n/2 ; j += 1){
int p = vals[j].second;
// ans[p][l[p]] = i;
l[p] += 1;
}
for(int j = n/2 ; j < n ; j += 1){
int p = vals[j].second;
// ans[p][r[p]] = i;
r[p] -= 1;
v[j].first -= 1;
}
}
allocate_tickets(ans);
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |