#include <bits/stdc++.h>
#include "dreaming.h"
using namespace std;
vector<pair<int, int>> graph[100001];
int travelTime(int n, int m, int l, int a[], int b[], int t[]) {
if (n == 1)
{
return 0;
}
if (n == 2)
{
if (m == 1)
{
return t[0];
}
return l;
}
int maxDist = 0;
int secondMaxDist = 0;
int thirdMaxDist = 0;
for (int i = 0; i < m; i++)
{
if (t[i] > maxDist)
{
thirdMaxDist = secondMaxDist;
secondMaxDist = maxDist;
maxDist = t[i];
}
else if (t[i] > secondMaxDist)
{
thirdMaxDist = secondMaxDist;
secondMaxDist = t[i];
}
else if (t[i] > thirdMaxDist)
{
thirdMaxDist = t[i];
}
}
return max(maxDist + secondMaxDist + l, secondMaxDist + thirdMaxDist + l + l);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3072 KB |
Output is correct |
2 |
Correct |
13 ms |
3456 KB |
Output is correct |
3 |
Correct |
13 ms |
3456 KB |
Output is correct |
4 |
Correct |
13 ms |
3584 KB |
Output is correct |
5 |
Correct |
14 ms |
3516 KB |
Output is correct |
6 |
Correct |
13 ms |
3456 KB |
Output is correct |
7 |
Correct |
14 ms |
3456 KB |
Output is correct |
8 |
Correct |
12 ms |
3448 KB |
Output is correct |
9 |
Correct |
12 ms |
3456 KB |
Output is correct |
10 |
Correct |
14 ms |
3456 KB |
Output is correct |
11 |
Correct |
2 ms |
2688 KB |
Output is correct |
12 |
Correct |
2 ms |
2688 KB |
Output is correct |
13 |
Correct |
2 ms |
2736 KB |
Output is correct |
14 |
Correct |
2 ms |
2688 KB |
Output is correct |
15 |
Correct |
3 ms |
2688 KB |
Output is correct |
16 |
Correct |
2 ms |
2688 KB |
Output is correct |
17 |
Correct |
2 ms |
2688 KB |
Output is correct |
18 |
Correct |
3 ms |
2688 KB |
Output is correct |
19 |
Correct |
2 ms |
2688 KB |
Output is correct |
20 |
Correct |
2 ms |
2688 KB |
Output is correct |
21 |
Correct |
2 ms |
2688 KB |
Output is correct |
22 |
Correct |
2 ms |
2688 KB |
Output is correct |
23 |
Correct |
3 ms |
2688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |