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;
/// Sub 2
long long min_total_length(vector<int>r, vector<int>b){
int p1 = r.size() - 1, p2 = b.size() - 1;
long long sum = 0;
while(p1 >= 0 && p2 >= 0){
sum += b[p2] - r[p1];
p2--;
p1--;
}
if(p1 < 0){
for(int i = p2;i >= 0;--i){
sum += b[i] - r.back();
}
}
else{
for(int i = p1;i >= 0;--i){
sum += b[0] - r[i];
}
}
return sum;
}
//int main()
//{
// int n, m;
// cin >> n >> m;
// vector<int>v(n), l(m);
// for(int i = 0;i < n;++i){
// cin >> v[i];
// }
// for(int i = 0;i < m;++i){
// cin >> l[i];
// }
// cout << min_total_length(v, l);
//}
# | 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... |