abc179_b - Go To Jail
28 Jan 2021 — Tags: None
Click to show code.
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
int main(void)
{
int n;
cin >> n;
vector<ii> d(n);
for (auto &[f, s] : d)
cin >> f >> s;
int cnt = 0;
for (auto [f, s] : d)
{
if (f == s)
{
cnt++;
}
else
{
if (cnt >= 3)
{
cout << "Yes" << endl;
return 0;
}
cnt = 0;
}
}
if (cnt >= 3)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}