#include "wiring.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pb push_back
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n=r.size(),m=b.size();
ll res=0;
for(int i=n-1,j=m-1;i>=0 || j>=0;j--){
if(i==0 && j>0){
while(j>=0){
res+=b[j]-r[n-1];
j--;
}
}
else if(i>0 && j==0){
while(i>=0){
res+=b[0]-r[i];
i--;
}
}
else{
res+=b[j]-r[i];
i--;
}
}
/*ll dp[n+1][m+1];
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(r[i-1]>b[j-1]){
dp[]
}
else{
}
}
}*/
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
12 ms |
2944 KB |
Output is correct |
4 |
Correct |
13 ms |
2908 KB |
Output is correct |
5 |
Incorrect |
12 ms |
3064 KB |
3rd lines differ - on the 1st token, expected: '41752125325332', found: '41751793659533' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '25859', found: '-4909' |
2 |
Halted |
0 ms |
0 KB |
- |