# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583888 | PiejanVDC | Wiring (IOI17_wiring) | C++17 | 30 ms | 3264 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;
long long min_total_length(vector<int>r, vector<int>b) {
long long ans = 0;
for(int i = 0 ; i < min(b.size(),r.size()) ; i++) {
ans += min(b[i] - r[r.size()-1] + b[0] - r[r.size() - 1 - i], b[i] - r[r.size() - 1 - i]);
}
if(b.size() > r.size()) {
for(int i = r.size() ; i < b.size() ; i++)
ans += b[i] - r[r.size()-1];
} else {
for(int i = r.size() - 1 - b.size() ; i >= 0 ; i--)
ans += b[0] - r[i];
}
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... |