Result: Accepted
Time: 5ms
Memory: 1092kB
#include<stdio.h>
int main(void){
int x[2],y[2],z[2],k,m,n;
for(int i=0;i<2;i++){
scanf("%d%d%d",&x[i],&y[i],&z[i]);
}
if(x[0]<x[1]){
if(x[1]-x[0]>1)printf("N o\n");
else{
m=y[1]+24-y[0];
if(m>24)printf("N o\n");
else if(m=24){
if(z[1]-z[0]>0)printf("N o\n");
else printf("Y e s\n");
}
else printf("Y e s\n");
}
}
else if(x[0]>x[1]){
k=x[1]+7-x[0];
if(k>1)printf("N o\n");
else{
m=y[1]+24-y[0];
if(m>24)printf("N o\n");
else if(m=24){
if(z[1]-z[0]>0)printf("N o\n");
else printf("Y e s\n");
}
else printf("Y e s\n");
}
}
else printf("Y e s\n");
return 0;
}