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