Result: Accepted
Time: 6ms
Memory: 1092kB
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int n,m,k,n1,m1,k1;
scanf("%d %d %d",&n,&m,&k);
scanf("%d %d %d",&n1,&m1,&k1);
if(n1<n){
n1+=7;
}
if(n1-n>1){
printf("N o\n");
}
else{
if(n1-n==0){
printf("Y e s\n");
}
if(n1-n==1){
if(k<=k1&&k!=0){
if((24-m-1+m1)*60+k1+60-k<=1440){
printf("Y e s\n");
}else{
printf("N o\n");
}
}
if(k<=k1&&k==0){
if((24-m+m1)*60+k1<=1440){
printf("Y e s\n");
}else{
printf("N o\n");
}
}
if(k>k1){
if((24-m-1+m1)*60+60-k+k1<=1440){
printf("Y e s\n");
}else{
printf("N o\n");
}
}
}
}
return 0;
}