# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
302997 | ivan24 | Carnival Tickets (IOI20_tickets) | C++14 | 2 ms | 768 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 <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define F first
#define S second
class Solver{
private:
ll k,n,m;
vvi x;
public:
Solver(ll k,vvi x): k(k),x(x){
n = x.size(); m = x[0].size();
}
ll solve(){
vi te;
for (auto i: x){
te.push_back(i[0]);
}
sort(te.begin(),te.end());
ll res = 0;
for (ll i = 0; te.size() > i*2; i++){
res += te[n-i-1]-te[i];
}
allocate_tickets(vvi(n,vi{0}));
return res;
}
};
long long find_maximum(int k, std::vector<std::vector<int>> x) {
Solver mySolver(k,x);
return mySolver.solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |