Submission
Status:
----------
Score: 0
User: KhunKK9722
Problemset: ไฟส่อง
Language: cpp
Time: 0.001 second
Submitted On: 2025-03-08 17:01:41
#include <stdio.h>
int n;
int a[360]={};
int tmp1,tmp2;
int ans=0;
int main(){
scanf("%d",&n);
for(int i = 0; i < n; i++){
scanf("%d %d",&tmp1,&tmp2);
if(tmp2<tmp1) tmp2+=360;
for(int x = tmp1-1; x < tmp2; x++){
if(x>=360) a[x-360]=1;
else a[x]=1;
}
}
int tmp = 0;
for(int i = 0; i < 360; i++){
if(a[i]==1&&a[i+1]==1) tmp++;
else if (a[i]==1) if(tmp > ans) ans = tmp;
else tmp=0;
}
printf("%d",ans);
}