-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChef_and_Meetings.cpp
More file actions
86 lines (86 loc) · 1.87 KB
/
Chef_and_Meetings.cpp
File metadata and controls
86 lines (86 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while(t--){
string a,b;
cin>>a>>b;
ll int g=0;
if(b[0]=='A')
{
if(a[0]==1 && a[1]==2)
{
g = a[3]*10+a[4];
}
else{
g = a[0]*1000+a[1]*100+a[3]*10+a[4];
}
}
else{
if(a[0]==1 && a[1]==2)
{
g = 1200 + a[3]*10+a[4];
}
else{
g = 1200+a[0]*1000+a[1]*100+a[3]*10+a[4];
}
}
int n;
cin>>n;
string c,d,e,f;
for(int j=0;j<n;j++)
{
cin>>c>>d>>e>>f;
ll int h=0,i=0;
if(d[0]=='A')
{
if(c[0]==1 && c[1]==2)
{
h = c[3]*10+c[4];
}
else{
h = c[0]*1000+c[1]*100+c[3]*10+c[4];
}
}
if(d[0]=='P'){
if(c[0]==1 && c[1]==2)
{
h = 1200 + c[3]*10+c[4];
}
else{
h = 1200+c[0]*1000+c[1]*100+c[3]*10+c[4];
}
}
if(f[0]=='A')
{
if(e[0]==1 && e[1]==2)
{
i = e[3]*10+e[4];
}
else{
i = e[0]*1000+e[1]*100+e[3]*10+e[4];
}
}
if(f[0]=='P'){
if(e[0]==1 && e[1]==2)
{
i = 1200 + e[3]*10+e[4];
}
else{
i = 1200+e[0]*1000+e[1]*100+e[3]*10+e[4];
}
}
if(h<=g<=i)
{
cout<<"1";
}
else{
cout<<"0";
}
}
}
cout<<endl;
return 0;
}