이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()
//===================//
// begin program //
//===================//
const int MX = 5e5;
vii all;
bitset<MX> connected;
int n, m, N;
int gd(int i, int j) {
return abs(all[i].fi - all[j].fi);
}
long long min_total_length(std::vector<int> r, std::vector<int> b) {
ll ans = 0;
n = r.sz, m = b.sz;
N = n+m;
// subtask 2
reverse(b.begin(), b.end());
if(n < m) {
RE(i,n) ans += abs(r[i]-b[i]);
RE(i,m-n) ans += abs(r[n-1]-b[n+i]);
} else {
RE(i,m) ans += abs(r[i]-b[i]);
RE(i,n-m) ans += abs(r[m+i]-b[m-1]);
}
return ans;
}
# | 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... |