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 "dreaming.h"
using namespace std;
const long long mod=1e9+7;
int n,m,l;
multiset<int>ms;
int travelTime(int N, int M, int L, int A[], int B[], int T[])
{
n=N,m=M,l=L;
for(int i=0;i<m;i++)ms.insert(T[i]);
if(m==0)
{
if(n==1)return 0;
if(n==2)return l;
else return l+l;
}
if(m==1)
{
if(n==2)return l+T[0];
else return l+max(l,T[0]);
}
else
{
int mx=*--ms.end();
ms.erase(--ms.end());
int mxx=*--ms.end();
return max(l,mx)+max(l,mxx);
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |