# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526791 | PurpleCrayon | Carnival Tickets (IOI20_tickets) | C++17 | 999 ms | 134912 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;
#define sz(v) int(v.size())
typedef long long ll;
ll cost(int k, vector<vector<int>> x, vector<vector<int>> s) {
int n = sz(x), m = sz(x[0]);
vector<vector<int>> a(k);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (s[i][j] != -1) {
a[s[i][j]].push_back(x[i][j]);
}
}
}
ll ans = 0;
for (auto& v : a) {
sort(v.begin(), v.end());
int m = v[sz(v)/2];
for (auto& c : v) ans += abs(c - m);
}
return ans;
}
ll find_maximum(int k, vector<vector<int>> x) {
int n = sz(x), m = sz(x[0]);
vector<pair<ll, int>> add;
# | 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... |