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<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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |