# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56258 | ngkan146 | Wiring (IOI17_wiring) | C++11 | 83 ms | 13580 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 "wiring.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int,int> ii;
ll dp[200005], prefixSum[200005], rem[200005];
ll min_total_length(vector<int> r, vector<int> b) {
vector <ii> lst;
int piR = 0, piB = 0;
while(piR < r.size() || piB < b.size()){
if (piR == r.size())
lst.push_back(ii(b[piB++], 2));
else if (piB == b.size())
lst.push_back(ii(r[piR++], 1));
else{
if (r[piR] < b[piB])
lst.push_back(ii(r[piR++], 1));
else
lst.push_back(ii(b[piB++], 2));
}
}
piR = 0, piB = 0;
int slope = 0, lrange = 0, rrange = 0;
r.push_back((int)2e9+5);
b.push_back((int)2e9+5);
for(int i=0;i<lst.size();i++){
dp[i+1] = (ll) 1e18;
prefixSum[i+1] = prefixSum[i] + (lst[i].second == 1 ? 1 : -1) * lst[i].first;
slope += (lst[i].second == 1 ? 1 : -1);
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... |