#include<stdio.h>
#define N_ 100001
int N;
int days[] = {0, 31, 59, 90,120,151,181,212,243,273,304,334,365};
int date_to_num(int m,int d){ return days[m-1] + d; }
int T[366];
int D[N_+1][2];
int main(){
int i,j;
scanf("%d",&N);
for(i=1; i<=N; i++){
int a, b, c, d; scanf("%d%d%d%d",&a,&b,&c,&d);
D[i][0] = date_to_num(a,b);
D[i][1] = date_to_num(c,d);
}
for(i=60; i<=334; i++){
for(j=1; j<=N; j++){
if(D[j][0] <= i && i < D[j][1]){
if(T[i] > T[D[j][0]-1] + 1 || !T[i]) T[i] = T[D[j][0]-1] + 1;
}
}
}
printf("%d\n",T[334]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
0 ms |
1668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
0 ms |
1668 KB |
Output is correct |
5 |
Correct |
4 ms |
1668 KB |
Output is correct |
6 |
Correct |
11 ms |
1668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1668 KB |
Output is correct |
2 |
Correct |
19 ms |
1668 KB |
Output is correct |
3 |
Correct |
28 ms |
1668 KB |
Output is correct |
4 |
Correct |
35 ms |
1668 KB |
Output is correct |
5 |
Correct |
58 ms |
1668 KB |
Output is correct |
6 |
Correct |
58 ms |
1668 KB |
Output is correct |
7 |
Correct |
77 ms |
1668 KB |
Output is correct |
8 |
Correct |
157 ms |
1668 KB |
Output is correct |
9 |
Correct |
84 ms |
1668 KB |
Output is correct |
10 |
Correct |
90 ms |
1668 KB |
Output is correct |