#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 t=0;
auto tr=r,tb=b;
reverse(r.begin(),r.end());reverse(b.begin(),b.end());
while(!r.empty()&&!b.empty()){
int rr=r.back(),bb=b.back();
r.pop_back();b.pop_back();
t+=abs(rr-bb);
}
while(!r.empty()){
int rr=r.back();t+=abs(rr-tb[0]);r.pop_back();
}
while(!b.empty()){
int bb=b.back();t+=abs(bb-tr.back());b.pop_back();
}
return t;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '26399' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
15 ms |
3468 KB |
Output is correct |
4 |
Correct |
15 ms |
3412 KB |
Output is correct |
5 |
Correct |
14 ms |
3488 KB |
Output is correct |
6 |
Correct |
17 ms |
4648 KB |
Output is correct |
7 |
Correct |
17 ms |
4564 KB |
Output is correct |
8 |
Correct |
18 ms |
4520 KB |
Output is correct |
9 |
Correct |
22 ms |
4524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
296 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '17703', found: '19052' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
3rd lines differ - on the 1st token, expected: '27', found: '30' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '26399' |
2 |
Halted |
0 ms |
0 KB |
- |