제출 #81181

#제출 시각아이디문제언어결과실행 시간메모리
81181GoodTrung전선 연결 (IOI17_wiring)C++14
0 / 100
32 ms1648 KiB
#include <bits/stdc++.h> #define fi first #define se second #define NAME "wiring" using namespace std; typedef long long LL; typedef pair <int, int> pii; typedef double DB; typedef pair <LL, LL> pLL; const int NMAX = 1e6+7; int n, m; LL min_total_length(vector <int> r, vector <int> b) { LL res = 0; n = r.size(); m = b.size(); sort(r.begin(), r.end()); sort(b.begin(), b.end()); if(r[n-1] < b[0]) { for(int i = 0; i < n; ++i) res -= r[i]; for(int i = 0; i < m; ++i) res += b[i]; res += max(n - m, 0) * b[0]; res -= max(m - n, 0) * r[n-1]; return res; } return -1; }
#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...