Result: Accepted
Time: 7ms
Memory: 1092kB
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
int d1,d2,h1,h2,m1,m2,flag=0;
long long t1,t2;
scanf("%d %d %d",&d1,&h1,&m1);
scanf("%d %d %d",&d2,&h2,&m2);
if(d1==7&&d2==1)
{
if(h2-h1<0)
{flag=1;}
else if(h2-h1>0)
{flag=0;}
else if(h2-h1==0)
{
if(m2-m1<=0)
flag=1;
else
flag=0;}
if(flag)
printf("Y e s\n");
else
printf("N o\n");
}
else
{
t1=d1*24*60+h1*60+m1;
t2=d2*24*60+h2*60+m2;
if(t2-t1<=1440&&t2-t1>=0)
printf("Y e s\n");
else
printf("N o\n");
}
}