Submission #4905

#TimeUsernameProblemLanguageResultExecution timeMemory
4905gs13068공주님의 정원 (KOI11_flower)C++98
18 / 18
52 ms2648 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...