Submission #800619

#TimeUsernameProblemLanguageResultExecution timeMemory
800619APROHACKCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms596 KiB
#include "tickets.h" #include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; int n, m, K; long long find_maximum(int k, std::vector<std::vector<int>> x) { n = x.size(); m = x[0].size(); K = k; std::vector<std::vector<int>> answer; vector<int>row; for(int i = 0 ; i < m ; i ++)row.pb(-1); for(int i = 0 ; i < n ; i ++)answer.pb(row); ll ans = 0; for(int r = 0 ; r < k ; r ++){ vector<ll>acum; for(int i = 0 ; i < n ; i += 2){ answer[i][r] = r; acum.pb(x[i][r]); } for(int i = 1 ; i < n ; i += 2){ answer[i][m-1-r] = r; acum.pb(x[i][m-1-r]); } sort(acum.begin(), acum.end()); for(int i = 0, j = n-1; i < j; i ++, j--){ ans += acum[j] - acum[i]; } } 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...