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>
#define ll long long
#define sz(a) (ll)(a.size())
#define pb push_back
#define popb pop_back
#define all(a) a.begin(),a.end()
#define here cerr<<"===================================\n"
#define endl '\n'
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;
#define maxn 100005
ll n,m,ans;
ll a[maxn],c[maxn];
long long min_total_length(vector<int> r, vector<int> b) {
for(ll x : r) a[++n] = x;
for(ll x : b) c[++m] = x;
if(a[n]<c[1]){
reverse(all(r));
while(sz(r)>1&&sz(b)>1){
ans+=abs(r.back()-b.back());
r.popb(); b.popb();
}
if(sz(r)<sz(b)) swap(r,b);
for(ll x : r) ans+=abs(x-b[0]);
return ans;
}
return 0;
}
# | 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... |