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 "wiring.h"
#include <cmath>
#include <iostream>
using namespace std;
//#define int long long
const int MAX_POINT = 200 + 2;
const int INF = 1e9 + 7;
int nbRouge, nbBleu;
long long dp[MAX_POINT][MAX_POINT];
vector<pair<int, int> > position;
long long min_total_length(vector<int> r, vector<int> b)
{
nbRouge = (int)r.size();
nbBleu = (int)b.size();
long long result = 0;
if(nbRouge > nbBleu)
{
int curBleu = nbBleu - 1;
for(int curRouge = nbRouge - 1; curRouge > -1; curRouge--)
{
result += b[curBleu] - r[curRouge];
curBleu = max(0, curBleu - 1);
}
}
else
{
int curRouge = 0;
for(int curBleu = 0; curBleu < nbBleu; curBleu++)
{
result += b[curBleu] - r[curRouge];
curRouge = min(curRouge + 1, nbRouge - 1);
}
}
return result;
}
# | 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... |