Submission #416471

#TimeUsernameProblemLanguageResultExecution timeMemory
416471arvindr9Wiring (IOI17_wiring)C++14
0 / 100
1 ms252 KiB
#include <bits/stdc++.h> using namespace std; #define pi pair<int, int> #define pb push_back #define mp make_pair #define eb emplace_back #define f first #define s second typedef long long ll; ll min_total_length(vector<int> r, vector<int> b) { int n = r.size(); int m = b.size(); sort(r.begin(), r.end()); sort(b.begin(), b.end()); int mn = min(n, m); ll ans = 0; for (int i = 0; i < mn; i++) { ans += (r[i] - b[n - 1 - i]); } for (int i = mn; i < max(n, m); i++) { if (i < m) ans += (r[i] - b[0]); else ans += (r[0] - b[n - 1 - i]); } 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...