제출 #711610

#제출 시각아이디문제언어결과실행 시간메모리
711610penguinman전선 연결 (IOI17_wiring)C++17
13 / 100
31 ms7996 KiB
#include "wiring.h" #include <bits/stdc++.h> using std::cin; using std::cout; using std::vector; using ll = long long; using vi = vector<ll>; using vii = vector<vi>; using std::string; using pii = std::pair<ll,ll>; #define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++) #define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++) #define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--) #define ln "\n" #define all(a) a.begin(), a.end() #define mp std::make_pair #define pb emplace_back constexpr ll inf = (1ll<<60); long long min_total_length(std::vector<int> r, std::vector<int> b) { vector<pii> data; for(auto el: r) data.pb(mp(el,0)); for(auto el: b) data.pb(mp(el,1)); sort(all(data)); ll N = r.size(), M = b.size(); ll ans = 0; rep(i,0,N) ans -= r[i]; rep(i,0,M) ans += b[i]; if(N < M) ans -= r.back()*(M-N); else ans += b[0]*(N-M); 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...