#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
int n, m;
ll min_total_length(vi r, vi b)
{
n = r.size(), m = b.size();
sort(all(r));
sort(all(b));
int i= 0, j = 0 ;
ll ans= 0ll;
while(i < n || j < m)
{
if(i == n)
ans += b[j++] - r[i - 1];
else if(j == m)
ans += b[0] - r[i++];
else
ans += b[j++] - r[i++];
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
18 ms |
2872 KB |
Output is correct |
4 |
Correct |
24 ms |
2892 KB |
Output is correct |
5 |
Correct |
19 ms |
2792 KB |
Output is correct |
6 |
Correct |
25 ms |
3884 KB |
Output is correct |
7 |
Correct |
24 ms |
3816 KB |
Output is correct |
8 |
Correct |
27 ms |
3756 KB |
Output is correct |
9 |
Correct |
24 ms |
3756 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: '-19052' |
3 |
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: '27', found: '12' |
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: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |