#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 |
1 |
Correct |
0 ms |
2652 KB |
Output is correct |
2 |
Correct |
0 ms |
2652 KB |
Output is correct |
3 |
Correct |
0 ms |
2652 KB |
Output is correct |
4 |
Correct |
0 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2652 KB |
Output is correct |
2 |
Correct |
0 ms |
2652 KB |
Output is correct |
3 |
Correct |
0 ms |
2652 KB |
Output is correct |
4 |
Correct |
0 ms |
2652 KB |
Output is correct |
5 |
Correct |
0 ms |
2652 KB |
Output is correct |
6 |
Correct |
4 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2652 KB |
Output is correct |
2 |
Correct |
12 ms |
2652 KB |
Output is correct |
3 |
Correct |
16 ms |
2652 KB |
Output is correct |
4 |
Correct |
20 ms |
2652 KB |
Output is correct |
5 |
Correct |
24 ms |
2652 KB |
Output is correct |
6 |
Correct |
24 ms |
2652 KB |
Output is correct |
7 |
Correct |
36 ms |
2652 KB |
Output is correct |
8 |
Correct |
56 ms |
2652 KB |
Output is correct |
9 |
Correct |
36 ms |
2652 KB |
Output is correct |
10 |
Correct |
44 ms |
2652 KB |
Output is correct |