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 <cstdio>
int day(int m,int d){
return d+(m-1)*30+(m==2)-(m==3)+(m>5)+(m>7)+(m>8)+(m>10);
}
int main(){
int n,p,q,r,s;
scanf("%d",&n);
int a[n],b[n];
for (int i=0; i<n; i++) {
scanf("%d %d %d %d",&p,&q,&r,&s);
a[i]=day(p,q);
b[i]=day(r,s);
}
r=0;
// a[i] ~ b[i]-1. flower in
int now=s=day(3,1);
while (now<=day(11,30)) {
for (int i=0; i<n; i++) {
if(a[i]<=now && s<b[i]) s=b[i];
}
if(s==now){
printf("0");
return 0;
}
now=s;
r++;
}
printf("%d",r);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |