제출 #1329490

#제출 시각아이디문제언어결과실행 시간메모리
1329490kawhietWiring (IOI17_wiring)C++20
13 / 100
15 ms1960 KiB
#include <bits/stdc++.h>
#include "wiring.h"
using namespace std;

constexpr int inf = 1e9;

long long min_total_length(vector<int> a, vector<int> b) {
	int n = a.size(), m = b.size();
	long long ans = 0;
	int i = n - 1, j = 0;
	while (i >= 0 && j < m) {
		ans += b[j] - a[i];
		i--; j++;
	}
	while (i >= 0) {
		ans += b[0] - a[i];
		i--;
	}
	while (j < m) {
		ans += b[j] - a[n - 1];
		j++;
	}
	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...