# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
361706 | MoldovanAndrei1 | Wiring (IOI17_wiring) | C++14 | 32 ms | 3820 KiB |
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"
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n = r.size() , m = b . size();
long long sum = 0 ;
if(n == m)
{
for(int i = 0 ; i < m ; i++)
sum += b[i];
for(int i = 0 ; i < n ; i++)
sum -= r[i];
return sum;
}
if(n > m )
{
sum += 1LL*b[0]*(n - m);
for(int i = 0 ; i < m ;i++)
sum += b[i];
for(int i = 0 ; i < n ; i++)
sum -= r[i];
return sum;
}
if(m > n)
{
sum -= 1LL*r[n-1]*(m - n);
for(int i = 0 ; i < m ; i++)
sum+=b[i];
for(int i = 0 ; i < n ; i++)
sum-=r[i];
return sum;
}
}
Compilation message (stderr)
# | 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... |