Submission #321228

#TimeUsernameProblemLanguageResultExecution timeMemory
32122812tqianWiring (IOI17_wiring)C++17
0 / 100
1 ms364 KiB
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

#define f1r(i, a, b) for (int (i) = (a); (i) < (b); ++i)
#define f0r(i, a) f1r(i, 0, a)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define sz(x) (int) (x).size()
#define all(v) (v).begin(), (v).end()
long long min_total_length(std::vector<int> r, std::vector<int> b) {
	ll n = sz(r);
	ll m = sz(b);
	ll ans = 0;
	ll gap = b[0] - r.back();
	ans += gap * max(n, m);
	for (int x : r) ans -= x;
	for (int x : b) ans += x;
	ans += n * b[0];
	ans -= m * r.back();
	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...