이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |