제출 #691607

#제출 시각아이디문제언어결과실행 시간메모리
691607zeroesandones전선 연결 (IOI17_wiring)C++17
13 / 100
27 ms2080 KiB
#include <bits/stdc++.h> #include "wiring.h" using namespace std; using ll = long long; using vi = vector<ll>; using pi = pair<long long, long long>; #define pb emplace_back ll min_total_length(vector<int> r, vector<int> b) { ll ans = 0; int n = r.size(); int m = b.size(); for(int i = 0; i < n; ++i) { if(m - i - 1 < 0) break; ans += abs(r[i] - b[m - i - 1]); } if(n < m) { for(int i = 0; i < m - n; ++i) { ans += b[i] - r[n - 1]; } } else if(m < n) { for(int i = m; i < n; ++i) { ans += b[0] - r[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...