#include "wiring.h"
#include <bits/stdc++.h>
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
sort(r.begin(), r.end());
sort(b.begin(), b.end());
while (r.size() > b.size()){
b.push_back(b[0]);
}
while (r.size() < b.size()){
r.push_back(r[r.size()-1]);
}
ll sumr=0,sumb=0;
for(auto&i : r) sumr += i;
for (auto&i : b) sumb += i;
return sumb - sumr;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
420 KB |
Output is correct |
3 |
Incorrect |
14 ms |
3124 KB |
3rd lines differ - on the 1st token, expected: '41596985758595', found: '227496835' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '17703', found: '-19052' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '27', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |