Submission #1044683

#TimeUsernameProblemLanguageResultExecution timeMemory
1044683cpdreamerCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms856 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; #define V vector #define S second #define F first #define pb push_back #define P pair #define all(v) v.begin(),v.end() typedef long long ll; long long find_maximum(int k, std::vector<std::vector<int>> x) { int N=x.size(); int M=x[0].size(); V<P<int,P<int,int>>>vp; for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ vp.pb({x[i][j],{i,j}}); } } sort(all(vp)); int size=vp.size(); ll ans=0; for(int i=0;i<(N*M)/2;i++){ ans-=vp[i].F; } V<V<int>>D(N,V<int>(M,-1)); for(int i=(N*M)/2;i<N*M;i++) ans+=vp[i].F; for(int i=1;i<=M;i++){ for(int j=1;j<=N/2;j++){ int id1=(i-1)*(N/2)+j-1; int id2=size-id1-1; D[vp[id1].S.F][vp[id1].S.S]=i-1; D[vp[id2].S.F][vp[id2].S.S]=i-1; } } allocate_tickets(D); return ans; }
#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...