제출 #416473

#제출 시각아이디문제언어결과실행 시간메모리
416473arvindr9전선 연결 (IOI17_wiring)C++14
13 / 100
38 ms3744 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[n - 1]); 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...