Submission #50266

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
502662018-06-08 20:24:01BruteforcemanWiring (IOI17_wiring)C++11
100 / 100
115 ms123848 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...