# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151445 | dolphingarlic | 전선 연결 (IOI17_wiring) | C++14 | 2 ms | 376 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 <math.h>
using namespace std;
long long min_total_length(vector<int> r, vector<int> b) {
long long ans = 0;
if (r.size() < b.size()) swap(r, b);
int rptr = 0;
for (int bptr = 0; bptr < b.size(); bptr++) {
do ans += abs(r[rptr++] - b[bptr]);
while (r.size() - rptr >= b.size() - bptr && (bptr == b.size() - 1 || abs(r[rptr] - b[bptr] < r[rptr] - b[bptr + 1])));
}
return ans;
}
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... |