#include "race.h"
int best_path(int N, int K, int H[][2], int L[])
{
int i,j,k;
int ans=N+1;
for(i=0;i<N-1;i++){
for(j=i+1;j<N;j++){
long long x=0;
for(k=i;k<j;k++){
x+=(long long)L[k];
}
if(x==K && ans>j-i)
ans=j-i;
}
}
if(ans==N+1)
ans=-1;
N=ans;
return N;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
528 KB |
Output is correct |
9 |
Correct |
2 ms |
528 KB |
Output is correct |
10 |
Correct |
2 ms |
544 KB |
Output is correct |
11 |
Correct |
2 ms |
544 KB |
Output is correct |
12 |
Correct |
2 ms |
544 KB |
Output is correct |
13 |
Correct |
3 ms |
560 KB |
Output is correct |
14 |
Correct |
2 ms |
560 KB |
Output is correct |
15 |
Correct |
2 ms |
560 KB |
Output is correct |
16 |
Correct |
2 ms |
560 KB |
Output is correct |
17 |
Correct |
2 ms |
560 KB |
Output is correct |
18 |
Correct |
2 ms |
560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
528 KB |
Output is correct |
9 |
Correct |
2 ms |
528 KB |
Output is correct |
10 |
Correct |
2 ms |
544 KB |
Output is correct |
11 |
Correct |
2 ms |
544 KB |
Output is correct |
12 |
Correct |
2 ms |
544 KB |
Output is correct |
13 |
Correct |
3 ms |
560 KB |
Output is correct |
14 |
Correct |
2 ms |
560 KB |
Output is correct |
15 |
Correct |
2 ms |
560 KB |
Output is correct |
16 |
Correct |
2 ms |
560 KB |
Output is correct |
17 |
Correct |
2 ms |
560 KB |
Output is correct |
18 |
Correct |
2 ms |
560 KB |
Output is correct |
19 |
Correct |
2 ms |
560 KB |
Output is correct |
20 |
Correct |
2 ms |
560 KB |
Output is correct |
21 |
Incorrect |
115 ms |
600 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
528 KB |
Output is correct |
9 |
Correct |
2 ms |
528 KB |
Output is correct |
10 |
Correct |
2 ms |
544 KB |
Output is correct |
11 |
Correct |
2 ms |
544 KB |
Output is correct |
12 |
Correct |
2 ms |
544 KB |
Output is correct |
13 |
Correct |
3 ms |
560 KB |
Output is correct |
14 |
Correct |
2 ms |
560 KB |
Output is correct |
15 |
Correct |
2 ms |
560 KB |
Output is correct |
16 |
Correct |
2 ms |
560 KB |
Output is correct |
17 |
Correct |
2 ms |
560 KB |
Output is correct |
18 |
Correct |
2 ms |
560 KB |
Output is correct |
19 |
Execution timed out |
3041 ms |
1756 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
528 KB |
Output is correct |
8 |
Correct |
2 ms |
528 KB |
Output is correct |
9 |
Correct |
2 ms |
528 KB |
Output is correct |
10 |
Correct |
2 ms |
544 KB |
Output is correct |
11 |
Correct |
2 ms |
544 KB |
Output is correct |
12 |
Correct |
2 ms |
544 KB |
Output is correct |
13 |
Correct |
3 ms |
560 KB |
Output is correct |
14 |
Correct |
2 ms |
560 KB |
Output is correct |
15 |
Correct |
2 ms |
560 KB |
Output is correct |
16 |
Correct |
2 ms |
560 KB |
Output is correct |
17 |
Correct |
2 ms |
560 KB |
Output is correct |
18 |
Correct |
2 ms |
560 KB |
Output is correct |
19 |
Correct |
2 ms |
560 KB |
Output is correct |
20 |
Correct |
2 ms |
560 KB |
Output is correct |
21 |
Incorrect |
115 ms |
600 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |