Submission #831412

#TimeUsernameProblemLanguageResultExecution timeMemory
831412Dremix10Carnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms596 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define all(x) (x).begin(),(x).end() const int N = 3e5+5; const int MOD = 1e9+7; const ll INF = 1e18+5; #ifdef dremix #define p2(x,y) cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl; #else #define p2(x,y) {} #define ppv(x) {} #endif long long find_maximum(int k, vector<vector<int> > x) { int n = x.size(); int m = x[0].size(); vector<vector<int> > answer; ll sum = 0; vector<int> arr; for (int i = 0; i < n; i++) { vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; arr.push_back(x[i][j]); } else { row[j] = -1; } } answer.push_back(row); } sort(all(arr)); int b = (arr[n/2]+arr[n/2-1])/2; for(auto v : arr){ sum += abs(b-v); } allocate_tickets(answer); return sum; }
#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...