-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·117 lines (104 loc) · 1.95 KB
/
Copy pathsol.cpp
File metadata and controls
executable file
·117 lines (104 loc) · 1.95 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
int teeth_upper_L = 8;
int teeth_lower_L = 8;
int teeth_upper_R = 8;
int teeth_lower_R = 8;
bool left_has_blue = false;
bool right_has_blue = false;
for (int i = 0; i < N; ++i)
{
string s;
char c;
cin >> s >> c;
//// SIDE OF TOOTH
bool rhs;
if (s[1] == '-' || s[1] == '+')
{
rhs = true;
}
else
{
rhs = false;
}
if (c == 'b')
{
if (rhs)
{
right_has_blue = true;
}
else
{
left_has_blue = true;
}
}
//// UPPER OR LOWER JAW
bool upper;
if (rhs)
{
if (s[1] == '+')
{
upper = true;
}
else
{
upper = false;
}
}
else
{
if (s[0] == '+')
{
upper = true;
}
else
{
upper = false;
}
}
//// MARK TOOTH
if (rhs)
{
if (upper)
{
--teeth_upper_R;
}
else
{
--teeth_lower_R;
}
}
else
{
if (upper)
{
--teeth_upper_L;
}
else
{
--teeth_lower_L;
}
}
}
if (left_has_blue && right_has_blue)
{
cout << 2 << endl;
}
else if (left_has_blue && teeth_upper_R > 0 && teeth_lower_R > 0)
{
cout << 1 << endl;
}
else if (right_has_blue && teeth_upper_L > 0 && teeth_lower_L > 0)
{
cout << 0 << endl;
}
else
{
cout << 2 << endl;
}
return 0;
}