-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcv2.cpp
More file actions
51 lines (48 loc) · 965 Bytes
/
cv2.cpp
File metadata and controls
51 lines (48 loc) · 965 Bytes
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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int t;
cin >> t;
int we = 1e6, fgfd = 1e8;
bool aq = true;
ll jio = -1;
bool euwi = true;
while (t--)
{
int x, y;
cin >> x >> y;
if (euwi and x == we and y != fgfd)
{
we = x;
fgfd = y;
euwi = false;
aq = true;
jio++;
}
else if (aq and y == fgfd and x != we)
{
we = x;
fgfd = y;
aq = false;
euwi = true;
jio++;
}
else if (y != fgfd and x != we)
{
we = x;
fgfd = y;
euwi = true;
aq = true;
jio++;
}
else
{
we = x;
fgfd = y;
}
}
cout << (jio + 1);
return 0;
}