-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChef and Meetings.cpp
108 lines (86 loc) · 1.95 KB
/
Chef and Meetings.cpp
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// https://www.codechef.com/FEB21C/problems/MEET
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int convert(char arr[])
{
/*for(int i=0; i<7; i++)
{
cout << arr[i] << " ";
}*/
int time = ((arr[0]-'0')*1000) + ((arr[1]-'0')*100) + ((arr[3]-'0')*10) + (arr[4]-'0');
// cout << "Hero " << time << endl;
if(arr[5] == 'A')
{
if(arr[0] == '1' && arr[1] == '2')
{
time -= 1200;
}
}
else
{
if(arr[0] == '1' && arr[1] == '2')
{
time = time;
}
else
{
time += 1200;
}
}
// cout << "Returning " << time << endl;
return time;
}
void solve()
{
char arr[7]; // = {'1', '2', ':', '0', '1', 'A', 'M'};
for(int i=0; i<7; i++)
{
cin >> arr[i];
}
int meeting = convert(arr);
// cout << "Meeting at " << meeting << endl;
ll people;
cin >> people;
int people_arr1[people];
int people_arr2[people];
char arr1[7], arr2[7];
for(int i=0; i<people; i++)
{
for(int j=0; j<7; j++)
{
cin >> arr1[j];
}
for(int j=0; j<7; j++)
{
cin >> arr2[j];
}
// char arr1[7] = {'1', '1', ':', '5', '9', 'A', 'M'};
// char arr2[7] = {'1', '1', ':', '5', '9', 'P', 'M'};
people_arr1[i] = convert(arr1);
people_arr2[i] = convert(arr2);
// cout << "Free from " << people_arr1[i] << " to " << people_arr2[i] << endl;
}
for(int i=0; i<people; i++)
{
if(meeting >= people_arr1[i] && meeting <= people_arr2[i])
{
cout << 1;
}
else
{
cout << 0;
}
}
cout << "\n";
}
int main()
{
ll test;
cin >> test;
while(test--)
{
solve();
}
return 0;
}