Submission #249277

#TimeUsernameProblemLanguageResultExecution timeMemory
249277ernestvwWiring (IOI17_wiring)C++11
0 / 100
30 ms4096 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 += R[i] - B[0]; for(int i = 0; i < m; ++i) ans += R[n - m + i] - B[i]; ans = -ans; } else {swap(n,m), swap(R, B); return solve();} 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...