# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
307456 | nicolaalexandra | Carnival Tickets (IOI20_tickets) | C++14 | 1 ms | 384 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 <bits/stdc++.h>
#include "tickets.h"
#define DIM 2000
using namespace std;
int n,m;
int f[DIM];
long long find_maximum (int k, vector<vector<int> > x){
n = x.size(), m = x[0].size();
int i;
vector <pair<int,int> > v;
vector <vector<int> > ans;
ans.resize(n);
for (i=0;i<n;i++)
ans[i].resize(m,-1);
for (i=0;i<n;i++)
v.push_back(make_pair(x[i][0],i));
sort (v.begin(),v.end());
long long sum = 0, mid;
for (i=0;i<n/2;i++){
sum -= v[i].first;
f[v[i].second] = 1;
ans[v[i].second][0] = 1;
mid = v[i].first;
}
for (i=0;i<n;i++)
if (!f[i]){
sum += x[i].back();
ans[i][m-1] = 1;
}
allocate_tickets(ans);
return sum;
}
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... |