#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);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |