Submission #353099

#TimeUsernameProblemLanguageResultExecution timeMemory
353099juggernautCarnival Tickets (IOI20_tickets)C++14
27 / 100
639 ms51820 KiB
#include"tickets.h" #include<bits/stdc++.h> #ifndef EVAL #include"grader.cpp" #endif using namespace std; long long find_maximum(int k,vector<vector<int>>x){ int n=x.size(); int m=x[0].size(); vector<vector<int>>answer(n,vector<int>(m,-1)); vector<pair<int,int>>pt(n,{0,m-1}); int i; long long res=0; int ans_id=0; while(k--){ vector<pair<int,int>>v; for(int i=0;i<n;i++) v.push_back({x[i][pt[i].first]+x[i][pt[i].second],i}); sort(v.begin(),v.end()); for(i=0;i<(n>>1);i++){ answer[v[i].second][pt[i].first]=ans_id; res-=1ll*x[v[i].second][pt[i].first]; pt[i].first++; } for(;i<n;i++){ answer[v[i].second][pt[i].second]=ans_id; res+=1ll*x[v[i].second][pt[i].second]; pt[i].second--; } ans_id++; } allocate_tickets(answer); return res; }
#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...