# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579321 | AugustinasJucas | Carnival Tickets (IOI20_tickets) | C++14 | 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 <bits/stdc++.h>
#include "tickets.h"
using namespace std;
vector<vector<int> > mas, ans;
vector<vector<pair<int, int> > > maz, did, pos;
long long check() {
vector<vector<int> > vec(m);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
if(ans[i][j] == -1) continue;
vec[ans[i][j]].push_back(mas[i][j]);
}
}
long long ret = 0;
for(int i = 0; i < k; i++) {
sort(vec[i].begin(), vec[i].end());
for(int j = 0; j < vec[i].size(); j++) {
if(j < vec[i].size() / 2) {
ret -= vec[i][j];
}else {
ret += vec[i][j];
}
}
}
return ret;
}
/*
2 3 3
1 2 3
3 1 4