제출 #1074927

#제출 시각아이디문제언어결과실행 시간메모리
1074927jer033전선 연결 (IOI17_wiring)C++17
13 / 100
19 ms7000 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll min_total_length_ll(std::vector<ll> r, std::vector<ll> b) { int n = r.size(); int m = b.size(); ll right_end = 0; ll left_end = 0; for (int i=0; i<n; i++) left_end += r[i]; for (int i=0; i<m; i++) right_end += b[i]; if (n<m) left_end += ((m-n)*(r[n-1])); if (m<n) right_end += ((n-m)*(b[0])); return right_end - left_end; } long long min_total_length(std::vector<int> r, std::vector<int> b) { int n = r.size(); int m = b.size(); vector<ll> rr(n); for (int i=0; i<n; i++) rr[i] = r[i]; vector<ll> bb(m); for (int i=0; i<m; i++) bb[i] = b[i]; return min_total_length_ll(rr, bb); }
#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...