Submission #416472

#TimeUsernameProblemLanguageResultExecution timeMemory
416472arvindr9Wiring (IOI17_wiring)C++14
0 / 100
25 ms2916 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 += (b[i] - r[n - 1 - i]); } for (int i = mn; i < max(n, m); i++) { if (i < m) ans += (b[i] - r[0]); else ans += (b[0] - r[n - 1 - i]); } return ans; } // int main() { // ios::sync_with_stdio(0); // cin.tie(0); // return 0; // }
#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...