提交时间:2024-01-07 16:27:09

运行 ID: 230143

#include <iostream> using namespace std; int n; int a[200005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int x, y; cin >> x >> y; for (int i = 1; i <= n; i++) { if (a[i] == x && a[i + 1] == y || a[i] == y && a[i + 1] == x) { cout << "Yes\n"; return 0; } } cout << "No\n"; }