제출 #589713

#제출 시각아이디문제언어결과실행 시간메모리
589713Mohammed_Atalah전선 연결 (IOI17_wiring)C++17
0 / 100
20 ms2796 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) {

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

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

	total += 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...