This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |