답안 #4905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4905 2014-01-09T11:19:55 Z gs13068 공주님의 정원 (KOI11_flower) C++
18 / 18
52 ms 2648 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2648 KB Output is correct
2 Correct 0 ms 2648 KB Output is correct
3 Correct 0 ms 2648 KB Output is correct
4 Correct 0 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2648 KB Output is correct
2 Correct 0 ms 2648 KB Output is correct
3 Correct 0 ms 2648 KB Output is correct
4 Correct 0 ms 2648 KB Output is correct
5 Correct 0 ms 2648 KB Output is correct
6 Correct 4 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2648 KB Output is correct
2 Correct 8 ms 2648 KB Output is correct
3 Correct 12 ms 2648 KB Output is correct
4 Correct 16 ms 2648 KB Output is correct
5 Correct 20 ms 2648 KB Output is correct
6 Correct 28 ms 2648 KB Output is correct
7 Correct 32 ms 2648 KB Output is correct
8 Correct 52 ms 2648 KB Output is correct
9 Correct 44 ms 2648 KB Output is correct
10 Correct 44 ms 2648 KB Output is correct