제출 #589717

#제출 시각아이디문제언어결과실행 시간메모리
589717Mohammed_Atalah전선 연결 (IOI17_wiring)C++17
13 / 100
25 ms3796 KiB
// Template path: /home/mohammed/.config/sublime-text-3/Packages/User
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;



long long min_total_length(std::vector<int> r, std::vector<int> b) {

	long long szr = r.size();
	long long szb = b.size();
	reverse(b.begin(), b.end());
	long long total = 0;
	for (int i = 0 ; i < szr - 1; i++) {
		total += ((long long)abs(r[i] - r[i + 1])) * (i + 1);
	}

	for (int i = 0 ; i < szb - 1; i++) {
		total += ((long long)abs(b[i] - b[i + 1]) ) * (i + 1);
	}

	total += ((long long)abs(r[szr - 1] - b[szb - 1])) * max(szr, szb);
	return total;

}
#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...