Submission #300870

#TimeUsernameProblemLanguageResultExecution timeMemory
300870aintaCarnival Tickets (IOI20_tickets)C++17
27 / 100
822 ms51432 KiB
#include "tickets.h" #include <vector> #include <algorithm> #define pii pair<int,int> using namespace std; int n, m, K, cc, L[1600], R[1600]; int PL[1600], PR[1600]; pii CL[1600]; vector<pii>V; long long find_maximum(int k, std::vector<std::vector<int>> x) { vector<vector<int>>res = x; n = x.size(); m = x[0].size(); K = k; int i, j; for(i=0;i<n;i++)for(j=0;j<m;j++)res[i][j]=-1; for(i=0;i<n;i++){ PL[i]=0,PR[i]=m-1; } long long ss=0; for(i=0;i<K;i++){ for(j=0;j<n;j++){ CL[j]={x[j][PL[j]]+x[j][PR[j]],j}; } sort(CL,CL+n); for(j=0;j<n;j++){ int t = CL[j].second; if(j<n/2){ ss-=x[t][PL[t]]; res[t][PL[t]]=i; PL[t]++; } else{ ss+=x[t][PR[t]]; res[t][PR[t]]=i; PR[t]--; } } } allocate_tickets(res); return ss; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...