#include #include #include #include #include using namespace std; using P=pair; int n, m; int a[200020], b[200020], c[200020]; vector

g[100010]; bool used[400040], finish[400040], ok; chrono::system_clock::time_point start, ed; void dfs(int x, int prev){ for(auto p:g[x]){ if(ok) return; ed = chrono::system_clock::now(); double time = static_cast(chrono::duration_cast(ed - start).count() / 1000.0); if(time>1900) return; int y=p.first, i=p.second; if(finish[i] || abs(i-prev)==m) continue; if(used[i]){ ok=1; return; }else{ used[i]=1; dfs(y, i); } finish[i]=1; } } int main() { start = chrono::system_clock::now(); scanf("%d %d", &n, &m); for(int i=0; i ind(n); mt19937 mt(334); iota(ind.begin(), ind.end(), 0); shuffle(ind.begin(), ind.end(), mt); for(auto i:ind){ dfs(i, 1000000007); if(ok){ printf("Yes\n"); return 0; } } printf("No\n"); return 0; }