이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wiring.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
ll tamr=r.size();
ll tamb=b.size();
ll c=0;
if(r[tamr-1]<b[0]){
ll i=0;
ll j=tamr-1;
ll k=j;
ll l=i;
ll sw=0;
//int c=0;
ll a;
while(sw<(min(tamr,tamb))){
a=abs(r[j]-b[i]);
//d=abs(r[j]-b[l]);
//e=abs(b[i]-r[k]);
//cout<<a<<"<"<<d<<"+"<<e<<endl;
c+=a;
//cout<<c<<endl;
i++;
j--;
sw++;
}
//cout<<j<<" "<<i<<endl;
if(tamb<tamr){
//j++;
for(ll h=j;h>=0;h--){
c+=abs(r[h]-b[l]);
}
}
else{
//i--;
//cout<<tamb<<endl;
for(ll h=i;h<tamb;h++){
c+=abs(b[i]-r[k]);
//cout<<r[h]<<"-"<<b[k]<<"="<<c<<endl;
//cout<<c<<endl;
}
}
//cout<<c<<endl;
return c;
}
return c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |