Submission #249279

#TimeUsernameProblemLanguageResultExecution timeMemory
249279ernestvwWiring (IOI17_wiring)C++11
13 / 100
36 ms5372 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; if(n >= m) { for(int i = 0; i < n - m; ++i) ans += B[0] - R[i]; for(int i = 0; i < m; ++i) ans += B[i] - R[n - m + i]; } else { for(int i = 0; i < n; ++i) ans += B[i] - R[i]; for(int i = 0; i < m - n; ++i) ans += B[n + i] - R[n-1]; } 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...