이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wiring.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
ll min_total_length(std::vector<int> r, std::vector<int> b)
{
ll res=0;
queue<int> q1,q2;
for (int i=0;i<sz(r);i++)q1.push(r[i]);
for (int i=0;i<sz(b);i++)q2.push(b[i]);
while(sz(q1) && sz(q2))
{
res+=abs(q1.ft-q2.ft);
q1.pop();
q2.pop();
}
while(sz(q1))
{
res+=abs(q1.ft-b[0]);
q1.pop();
}
while(sz(q2))
{
res+=abs(q2.ft-r[sz(r)-1]);
q2.pop();
}
return res;
}
# | 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... |