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>
using namespace std;
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
ll min_total_length(vector<int> a, vector<int> b) {
int n = sz(a), m = sz(b);
ll tot = 0;
for(int i = 0; i < m; i++) tot+=b[i];
for(int i = 0; i < n; i++) tot-=a[i];
if(n<m){
for(int i = 0; i < m-n; i++) tot-=a.back();
}
else if(n>m){
for(int i = 0; i < n-m; i++) tot+=b[0];
}
return tot;
}
# | 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... |