#pragma GCC optimize ("O2") #pragma GCC target ("avx") #include //#include //using namespace atcoder; using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define Would #define you #define please char dp[310][90100]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; int T[301][301]; int kazu[301] = {}; int kei = 0; rep1(i, N) rep1(j, N) { int tmp = i * j; int cnt = 0; rep(k, 30) cnt += (tmp >> k & 1); T[i][j] = (cnt % 2 == 0); kazu[i] += T[i][j]; kei += T[i][j]; kazu[i] += T[i][j]; } dp[0][0] = 1; rep(i, N) rep(j, 90000) if (dp[i][j] != 0) { dp[i + 1][j + kazu[i + 1]] = -(i + 1); dp[i + 1][j] = 1; } int erabu[310] = {}, k = 0; if (kei - M >= 0) { if (dp[N][kei - M]) { int tmp = kei - M; for (int i = N; i > 0; i--) { if (dp[i][tmp] < 0) { erabu[i] = 1; k++; tmp -= kazu[-dp[i][tmp]]; } } cosp(N - k); co(k); rep1(i, N) if (!erabu[i]) { k++; if (k < N) cout << i << " "; else cout << i << "\n"; } rep1(i, N) if (erabu[i]) { cout << i << " "; } return 0; } } if (kei + M <= 90000) { if (dp[N][kei + M]) { int tmp = kei + M; for (int i = N; i > 0; i--) { if (dp[i][tmp] < 0) { erabu[i] = 1; k++; tmp -= kazu[-dp[i][tmp]]; } } cosp(k); co(N - k); rep1(i, N) if (erabu[i]) { k--; if (k) cout << i << " "; else cout << i << "\n"; } rep1(i, N) if (!erabu[i]) { cout << i << " "; } return 0; } } co(-1); return 0; Would you please return 0; }