Submission #14338

# Submission time Handle Problem Language Result Execution time Memory
14338 2015-05-12T07:16:40 Z kyungjun2 공주님의 정원 (KOI11_flower) C
13.87 / 18
74 ms 1864 KB
#include<stdio.h>
int n,i,arr[100000][2],fmax,smax,sum;
int main(){
	scanf("%d",&n);
	for(i=0;i<n;i++){
		int t[4];
		scanf("%d %d %d %d",&t[0],&t[1],&t[2],&t[3]);
		arr[i][0]=t[0]*100+t[1];
		arr[i][1]=t[2]*100+t[3];
	}
	fmax=301;
	while(1){
		int t;
		t=fmax;
		for(i=n-1;i>=0;i--){
			if(arr[i][0]<=t){
				if(arr[i][1]>=fmax){
					fmax=arr[i][1];
				}
			}
		}
		if(smax!=fmax) sum++;
		else{
			goto s;
		}
		if(sum>n||fmax==t){
			goto s;
		}
		if(smax>=1130||fmax>=1130){
			break;
		}
		for(i=n-1;i>=0;i--){
			if(arr[i][0]<=fmax){
				if(arr[i][1]>=smax){
					smax=arr[i][1];
				}
			}
		}
		if(smax!=fmax) sum++;
		else{
			goto s;
		}
		if(sum>n||smax==t){
			s:
			printf("0");
			return 0;
		}
		if(smax>=1130||fmax>=1130){
			break;
		}
		fmax=smax;
	}
	if(fmax>smax){
		if(fmax<=1130) goto s;	
	}
	else if(smax<=1130) goto s;
	printf("%d",sum);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1864 KB Output is correct
2 Correct 0 ms 1864 KB Output is correct
3 Correct 0 ms 1864 KB Output is correct
4 Correct 0 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1864 KB Output is correct
2 Correct 0 ms 1864 KB Output is correct
3 Incorrect 0 ms 1864 KB Output isn't correct
4 Correct 0 ms 1864 KB Output is correct
5 Incorrect 0 ms 1864 KB Output isn't correct
6 Correct 5 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1864 KB Output is correct
2 Correct 0 ms 1864 KB Output is correct
3 Correct 11 ms 1864 KB Output is correct
4 Correct 21 ms 1864 KB Output is correct
5 Correct 17 ms 1864 KB Output is correct
6 Incorrect 27 ms 1864 KB Output isn't correct
7 Correct 30 ms 1864 KB Output is correct
8 Correct 36 ms 1864 KB Output is correct
9 Incorrect 74 ms 1864 KB Output isn't correct
10 Correct 47 ms 1864 KB Output is correct