Submission #1274600

#TimeUsernameProblemLanguageResultExecution timeMemory
1274600kl0989eWiring (IOI17_wiring)C++20
13 / 100
17 ms1956 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()

ll min_total_length(vi r, vi b) {
	ll ans=0;
	ll n=r.size();
	ll m=b.size();
	ans+=max(n,m)*(b[0]-r.back());
	for (ll i=1; i<n; i++) {
		ans+=i*(r[i]-r[i-1]);
	}
	for (ll i=1; i<m; i++) {
		ans+=(m-i)*(b[i]-b[i-1]);
	}
	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...