# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051402 | pcc | Carnival Tickets (IOI20_tickets) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
using namespace std;
#define ll long long
const int mxn = 2e5;
bitset<mxn> dp[mxn];
/*
int n = x.size();
int m = x[0].size();
std::vector<std::vector<int>> answer;
for (int i = 0; i < n; i++) {
std::vector<int> row(m);
for (int j = 0; j < m; j++) {
if (j < k) {
row[j] = j;
} else {
row[j] = -1;
}
}
answer.push_back(row);
}
allocate_tickets(answer);
return 1;
*/
long long find_maximum(int k, std::vector<std::vector<int>> x) {
for(auto &i:dp)i.set();
int N = x.size();
vector<ll> v;
for(int i = 0;i<N;i++)v.push_back(x[i][0]);
sort(v.begin(),v.end());
ll ans = 0;
for(int i = 0;i+i<N;i++){
ans += v[i+N/2]-v[i];
}
vector<vector<int>> ansv;
for(int i = 0;i<N;i++)ansv.push_back({0});
allocate_tickets(ansv);
return ans;
}