제출 #262151

#제출 시각아이디문제언어결과실행 시간메모리
262151youssefbou62전선 연결 (IOI17_wiring)C++14
13 / 100
40 ms2040 KiB
#include "wiring.h" #include <bits/stdc++.h> #define sz(x) (int)x.size() #define ll long long using namespace std; const int MAXN = 205 ; bool taken[MAXN] ; long long min_total_length(std::vector<int> r, std::vector<int> b) { int R = sz(r) , B = sz(b) ; ll ans = 0 ; for(int i = 0 , j = 0 ; j < B && i < R ; i++ , j++ ){ ans += 1LL*(b[i]-r[i]) ; } if(R>B){ for(int i = R-1 , c = 0 ; c < R-B ; c++ , i-- ){ ans += 1LL*abs(b[0]-r[i]); } }else{ for(int i = B-1 , c = 0 ; c < B-R ; c++ , i-- ){ ans += 1LL*abs(r[R-1]-b[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...