This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "wiring.h"
#define F first
#define S second
#define pii pair <int, int>
#define pb push_back
using namespace std;
typedef long long ll;
const int maxN = 210;
const ll oo = 1e16;
ll dp[maxN][maxN];
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n = r.size(), m = b.size();
ll ans = 0;
for (int i=0; i<m; i++) ans += b[i];
for (int i=0; i<n; i++) ans -= r[i];
if(n > m)
ans += (ll)b[0] * (n - m);
else ans -= (ll)r[n - 1] * (m - n);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |