# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70574 | Kmcode | Wiring (IOI17_wiring) | C++14 | 50 ms | 14180 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>
using namespace std;
#include "wiring.h"
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int rr=r.size()-1;
int bb=0;
long long int dist=0;
while(rr<r.size()||bb<b.size()){
if(bb>=b.size()){
dist+=b[0]-r[rr];
rr--;
continue;
}
if(rr<0){
dist+=b[bb]-r.back();
bb++;
continue;
}
dist+=b[min((int)b.size()-1,bb)]-r[max(0,rr)];
rr--;
bb++;
}
return dist;
}
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... |