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>
#include<algorithm>
struct flower
{
int sm,sd;
int em,ed;
} f[100000];
inline bool operator <(const flower &a,const flower &b)
{
if(a.sm!=b.sm)return a.sm<b.sm;
if(a.sd!=b.sd)return a.sd<b.sd;
if(a.em!=b.em)return a.em<b.em;
return a.ed<b.ed;
}
int main()
{
int m=3,d=1;
int nm=3,nd=1;
int i,n,res=1;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d%d%d%d",&f[i].sm,&f[i].sd,&f[i].em,&f[i].ed);
std::sort(f,f+n);
for(i=0;i<n&&nm<12;i++)
{
if(f[i].sm>m||(f[i].sm==m&&f[i].sd>d))
{
m=nm;
d=nd;
res++;
}
if(f[i].em>nm||(f[i].em==nm&&f[i].ed>nd))
{
nm=f[i].em;
nd=f[i].ed;
}
}
if(nm<12)printf("0");
else printf("%d",res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |