제출 #428382

#제출 시각아이디문제언어결과실행 시간메모리
428382yuto1115전선 연결 (IOI17_wiring)C++17
0 / 100
23 ms1404 KiB
#include "wiring.h" #include<bits/stdc++.h> #define rep(i, n) for(ll i = 0; i < ll(n); i++) #define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++) #define rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--) #define pb push_back #define eb emplace_back #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vp = vector<P>; using vvp = vector<vp>; using vb = vector<bool>; using vvb = vector<vb>; using vs = vector<string>; const int inf = 1001001001; const ll linf = 1001001001001001001; template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } ll min_total_length(vi r, vi b) { assert(r.back() < b[0]); int n = r.size(); int m = b.size(); ll ans = 0; if (n >= m) { rep(i, n - (m - 1)) ans += b[0] - r[i]; rep(i, m - 1) ans += b[i + 1] - r[n - (m - 1) + i]; } else { rep(i, n - 1) ans += b[i] - r[i]; rep2(i, n, m) ans += b[i] - r.back(); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...