제출 #262148

#제출 시각아이디문제언어결과실행 시간메모리
262148youssefbou62전선 연결 (IOI17_wiring)C++14
0 / 100
1 ms384 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*abs(r[i]-b[i]) ; } if(R>B){ for(int i = R-1 , c = 0 ; c < R-B ; c++ , i-- ){ ans += 1LL*abs(r[i]-b[B-1]); } }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...