# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50266 | Bruteforceman | Wiring (IOI17_wiring) | C++11 | 115 ms | 123848 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 "wiring.h"
using namespace std;
const long long inf = 1e15;
vector <long long> dp[200010];
vector <int> group[200010];
vector <long long> first[200010], last[200010];
typedef pair <int, int> pii;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int g = 0;
int n = r.size();
int m = b.size();
vector <pii> v;
for(int i = 0; i < n; i++) {
v.emplace_back(r[i], 0);
}
for(int i = 0; i < m; i++) {
v.emplace_back(b[i], 1);
}
sort(v.begin(), v.end());
int prevc = -1;
group[0].push_back(-1);
for(int i = 0; i < n+m; i++) {
if(prevc == v[i].second) {
group[g].push_back(v[i].first);
} else {
++g;
prevc = v[i].second;
# | 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... |