# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127112 | chubyxdxd | Wiring (IOI17_wiring) | C++11 | 35 ms | 3832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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=tamb-1;
ll k=tamr-1;
ll l=i;
ll sw=0;
//int c=0;
ll a,d,e;
while(sw<(min(tamr,tamb))){
a=abs(r[i]-b[j]);
//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=i;h<tamr;h++){
c+=abs(r[h]-b[l]);
}
}
else{
//i--;
//cout<<tamb<<endl;
for(ll h=0;h<=j;h++){
c+=abs(b[h]-r[k]);
//cout<<r[h]<<"-"<<b[k]<<"="<<c<<endl;
//cout<<c<<endl;
}
}
//cout<<c<<endl;
return c;
}
return c;
}
Compilation message (stderr)
# | 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... |