#include <bits/stdc++.h>
#include "wiring.h"
#define ll long long
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int max_r = INT_MIN, min_r = INT_MAX;
int max_b = INT_MIN, min_b = INT_MAX;
for(int i:r) {
if(i > max_r) max_r = i;
if(i < min_r) min_r = i;
}
for(int i:b) {
if(i > max_b) max_b = i;
if(i < min_b) min_b = i;
}
ll sum = (1LL * min_b - 1LL * max_r) * 1LL * max(r.size(), b.size());
for(int i:r) {
sum += 1LL * (max_r - i);
}
for(int i:b) {
sum += 1LL * (i - min_b);
}
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
24 ms |
2936 KB |
Output is correct |
4 |
Correct |
24 ms |
2936 KB |
Output is correct |
5 |
Correct |
24 ms |
2936 KB |
Output is correct |
6 |
Correct |
30 ms |
3832 KB |
Output is correct |
7 |
Correct |
31 ms |
3832 KB |
Output is correct |
8 |
Correct |
31 ms |
3836 KB |
Output is correct |
9 |
Correct |
31 ms |
3832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 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 |
2 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '27', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |