Submission #320016

#TimeUsernameProblemLanguageResultExecution timeMemory
320016wildturtleCarnival Tickets (IOI20_tickets)C++14
14 / 100
674 ms57988 KiB
#include "tickets.h" #include<bits/stdc++.h> using namespace std; int idx,ans,l,l1,A[500005]; set < pair < int , int > > st; long long find_maximum(int k, vector< vector < int > > x) { int n=x.size(); int m=x[0].size(); for(int i=0;i<n;i++) { for(int j=m-k;j<m;j++) { ans+=x[i][j]; } st.insert({x[i][m-k]+x[i][0],i}); } for(int i=1;i<=(n*k)/2;i++) { idx=(*st.begin()).second; ans-=(*st.begin()).first; st.erase(*st.begin()); A[idx]++; if(A[idx]<k) st.insert({x[idx][m-k+A[idx]]+x[idx][A[idx]],idx}); } vector < vector < int > > answer; for (int i = 0; i < n; i++) { vector<int> row; for (int j = 0; j < A[i]; j++) { row.push_back(l); l++; l%=k; } for(int j=A[i];j<m-(k-A[i]);j++) { row.push_back(-1); } l1=l; for(int j=m-(k-A[i]);j<m;j++) { row.push_back(l1); l1++; l1%=k; } answer.push_back(row); } allocate_tickets(answer); 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...