# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384763 | nicholask | Carnival Tickets (IOI20_tickets) | C++14 | 4 ms | 620 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 "tickets.h"
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
long long find_maximum(int k,vector <vector <int> > x){
ll n=x.size(),m=x[0].size();
vector <vector <int> > ans(n,vector <int>(m,-1));
if (k==1){
ll sum=0;
priority_queue <pair <ll,ll>,vector <pair <ll,ll> >,greater <pair <ll,ll> > > pq;
for (ll i=0; i<n; i++){
sum+=x[i][m-1];
pq.push({x[i][0]+x[i][m-1],i});
}
for (ll i=0; i<n; i++){
if (i<n/2){
sum-=pq.top().first;
ans[pq.top().second][0]=0;
} else ans[pq.top().second][m-1]=1;
pq.pop();
}
allocate_tickets(ans);
return sum;
}
}
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... |