Submission #301117

#TimeUsernameProblemLanguageResultExecution timeMemory
301117rocks03Carnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms256 KiB
#include<bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int) (x).size()) using namespace std; void allocate_tickets(vector<vector<int>> _d); int N, M; long long find_maximum(int k, vector<vector<int>> x){ N = SZ(x), M = SZ(x[0]); vector<vector<int>> alloc = x; ll ans = 0; if(M == 1){ vector<int> v = x[0]; sort(v.begin(), v.end()); int median1 = v[(N-1)/2], median2 = v[N/2]; ll ans1 = 0, ans2 = 0; for(int i = 0; i < N; i++){ ans1 += abs(median1 - v[i]); ans2 += abs(median2 - v[i]); } for(int i = 0; i < N; i++){ alloc[i][0] = 0; } ans = max(ans1, ans2); } allocate_tickets(alloc); 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...