#include <bits/stdc++.h>
#include "wiring.h"
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<long long, long long>;
#define pb emplace_back
ll min_total_length(vector<int> r, vector<int> b) {
ll ans = 0;
int n = r.size();
int m = b.size();
for(int i = 0; i < n; ++i) {
if(m - i - 1 < 0) break;
ans += abs(r[i] - b[m - i - 1]);
}
if(n < m) {
for(int i = 0; i < m - n; ++i) {
ans += b[i] - r[n - 1];
}
} else if(m < n) {
for(int i = m; i < n; ++i) {
ans += b[0] - r[i];
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '17621' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
16 ms |
1700 KB |
Output is correct |
4 |
Correct |
19 ms |
1668 KB |
Output is correct |
5 |
Correct |
23 ms |
1644 KB |
Output is correct |
6 |
Correct |
24 ms |
2080 KB |
Output is correct |
7 |
Correct |
27 ms |
1992 KB |
Output is correct |
8 |
Correct |
21 ms |
2076 KB |
Output is correct |
9 |
Correct |
20 ms |
2000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
300 KB |
3rd lines differ - on the 1st token, expected: '17703', found: '21996' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
296 KB |
3rd lines differ - on the 1st token, expected: '27', found: '100' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '17621' |
2 |
Halted |
0 ms |
0 KB |
- |