제출 #248526

#제출 시각아이디문제언어결과실행 시간메모리
248526ernestvw전선 연결 (IOI17_wiring)C++11
0 / 100
0 ms256 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define sz(x) ((int)x.size()) #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int n,m; vector<ll>R,B; ll solve() { ll ans = 0; for(int i = 0; i < n - 1; ++i) ans += B[0] - R[i]; for(int i = 1; i < m; ++i) ans += B[i] - R[n - 1]; if(n == 1) ans += B[0] - R[0]; else if(m == 1) ans += B[0] - R[0]; return ans; } ll min_total_length(vector<int> r, vector<int> b) { n = sz(r); m = sz(b); R.resize(n),B.resize(m); for(int i=0;i<n;++i)R[i]=r[i]; for(int i=0;i<m;++i)B[i]=b[i]; return solve(); }
#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...