Submission #519114

#TimeUsernameProblemLanguageResultExecution timeMemory
519114DanerZeinCarnival Tickets (IOI20_tickets)C++14
27 / 100
526 ms85220 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> // existen dos escenarios en el que la media sea maxima o en que sea minima using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<ll,ll> ii; typedef pair<ll,ii> iii; const int MAX_N=1510; bool vis[MAX_N]; vector<vi> ti; vector<vi> mat; vector<ii> vma; int n,m; long long find_maximum(int k, std::vector<std::vector<int>> x) { n=x.size(); m=x[0].size(); mat=x; ti.resize(n); for(int i=0;i<n;i++){ for(int j=0;j<m;j++) ti[i].push_back(-1); } vector<ii> su; for(int i=0;i<n;i++){ su.push_back(ii(-(x[i][0]+x[i][m-1]),i)); } sort(su.begin(),su.end()); ll ans=0; for(int i=0;i<n;i++){ if(i<n/2){ ti[su[i].second][m-1]=0; ans+=x[su[i].second][m-1]; } else { ti[su[i].second][0]=0; ans-=x[su[i].second][0]; } } allocate_tickets(ti); 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...