# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723869 | NemanjaSo2005 | Carnival Tickets (IOI20_tickets) | C++14 | 518 ms | 101288 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"
#define ll long long
using namespace std;
ll N,M,K,vred=0,pok[1505];
vector<vector<int>> kako,koliko;
struct slog{
int gde;
ll dob;
bool operator < (const slog &a) const{
return dob<a.dob;
}
}pp;
priority_queue<slog> PQ;
void stavi(int gde){
pp.gde=gde;
pp.dob=koliko[gde][pok[gde]]+koliko[gde][pok[gde]+M-K];
PQ.push(pp);
return;
}
ll find_maximum(int k,vector<vector<int>> d){
kako=d;
koliko=d;
for(int i=0;i<kako.size();i++)
for(int j=0;j<kako[i].size();j++)
kako[i][j]=-1;
K=k;
N=d.size();
M=d[0].size();
for(int i=0;i<N;i++){
pok[i]=K-1;
for(int j=0;j<K;j++){
kako[i][j]=j;
vred-=koliko[i][j];
}
stavi(i);
}
for(int it=1;it<=N*K/2;it++){
int gde=PQ.top().gde;
vred+=PQ.top().dob;
PQ.pop();
kako[gde][pok[gde]+M-K]=kako[gde][pok[gde]];
kako[gde][pok[gde]]=-1;
pok[gde]--;
stavi(gde);
}
allocate_tickets(kako);
return vred;
}
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... |