#include #include #include #include #include #include #include using namespace std; constexpr double TL = 1000.0; uint32_t randxor(){ static uint32_t x = 123456789; static uint32_t y = 362436069; static uint32_t z = 521288629; static uint32_t w = 88675123; uint32_t t; t = x ^ (x << 11); x = y; y = z; z = w; return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); } double zeroone(){ return ((double)randxor()+0.5)/(double)(UINT_MAX); } int main() { int n; long k; cin >> n >> k; double T0 = (double)n; double T1 = T0 * 0.1; if (n == 1) { if (k == 1) { cout << "Yes\n"; cout << "1\n1\n"; } else { cout << "No\n"; } return 0; } vector a(n); iota(a.begin(), a.end(), 1); long mx = 0, mn = 0; for (long i = 1; i <= n; i++) mx += i*i, mn += i*(n+1-i); long s = mx; if (abs(k-mx) > abs(k-mn)) { s = mn; reverse(a.begin(), a.end()); } auto start = chrono::system_clock::now(); long step = 0; double temp = T0; while (s != k) { auto now = chrono::system_clock::now(); auto elapsed = chrono::duration_cast(now - start).count(); if (elapsed > 950) break; step++; if (step % 100 == 0) { double p = elapsed / TL; temp = pow(T0, 1-p) * pow(T1, p); } int i = 0, j = 0; do{ i = randxor() % n; j = randxor() % n; } while(i == j); long sa = (i - j) * (a[i] - a[j]); long delta = abs(k - (s-sa)) - abs(k-s); if (delta < 0 or zeroone() < exp(-delta/temp)) { s -= sa; swap(a[i], a[j]); } } if (s == k) { cout << "Yes\n"; for (int i = 0; i < n; i++) cout << a[i] << " \n"[i == n - 1]; for (int i = 0; i < n; i++) cout << i+1 << " \n"[i == n - 1]; } else { cout << "No\n"; } }