// Template path: /home/mohammed/.config/sublime-text-3/Packages/User
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
long long szr = r.size();
long long szb = b.size();
reverse(b.begin(), b.end());
long long total = 0;
for (int i = 0 ; i < szr - 1; i++) {
total += ((long long)abs(r[i] - r[i + 1])) * (i + 1);
}
for (int i = 0 ; i < szb - 1; i++) {
total += ((long long)abs(b[i] - b[i + 1]) ) * (i + 1);
}
total += ((long long)abs(r[szr - 1] - b[szb - 1])) * max(szr, szb);
return total;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '59339' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
19 ms |
1408 KB |
Output is correct |
4 |
Correct |
15 ms |
2900 KB |
Output is correct |
5 |
Correct |
16 ms |
2792 KB |
Output is correct |
6 |
Correct |
25 ms |
3756 KB |
Output is correct |
7 |
Correct |
23 ms |
3756 KB |
Output is correct |
8 |
Correct |
21 ms |
3796 KB |
Output is correct |
9 |
Correct |
21 ms |
3768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '17703', found: '65108' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '27', found: '292' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '59339' |
2 |
Halted |
0 ms |
0 KB |
- |