Submission #5304

#TimeUsernameProblemLanguageResultExecution timeMemory
5304baneling100공주님의 정원 (KOI11_flower)C++98
18 / 18
56 ms2652 KiB
#include <stdio.h> #include <algorithm> using namespace std; typedef pair <int,int> ppair; pair <ppair,ppair> flower[100001]; int n, cnt; void input(void) { int i, a, b, c, d; scanf("%d",&n); for(i=1 ; i<=n ; i++) { scanf("%d %d %d %d",&a,&b,&c,&d); flower[i]=make_pair(make_pair(a,b),make_pair(c,d)); } sort(flower+1,flower+n+1); } void process(void) { int i, now=1, month=3, day=1, mmax, dmax; while(1) { mmax=dmax=0; for(i=now ; i<=n ; i++) { if(flower[i].first.first<month || (flower[i].first.first==month && flower[i].first.second<=day)) { if(mmax<flower[i].second.first) { mmax=flower[i].second.first; dmax=flower[i].second.second; } else if(mmax==flower[i].second.first) if(dmax<flower[i].second.second) dmax=flower[i].second.second; } else break; } if(mmax==0) { printf("0"); return; } now=i; cnt++; month=mmax; day=dmax; if(month==12) break; } printf("%d",cnt); } int main(void) { input(); process(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...