Submission #1123060

#TimeUsernameProblemLanguageResultExecution timeMemory
1123060LuvidiCarnival Tickets (IOI20_tickets)C++20
27 / 100
437 ms51364 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second long long find_maximum(int k, std::vector<std::vector<int>> a) { int n = a.size(); int m = a[0].size(); long long x=0; vector<vector<int>> ans(n,vector<int>(m,-1)); vector<pair<pii,pii>> v; for(int i=0;i<n;i++){ pii mx={-1,0},mn={1e9+1,0}; for(int j=0;j<m;j++){ mx=max(mx,{a[i][j],j}); mn=min(mn,{a[i][j],j}); } x-=mn.fs; v.push_back({{mn.fs+mx.fs,i},{mx.sc,mn.sc}}); } sort(v.rbegin(),v.rend()); for(int i=0;i<n/2;i++){ x+=v[i].fs.fs; ans[v[i].fs.sc][v[i].sc.fs]=0; } for(int i=n/2;i<n;i++){ ans[v[i].fs.sc][v[i].sc.sc]=0; } allocate_tickets(ans); return x; }
#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...