比赛 | 2025.9.6 | 评测结果 | AWWWWWWWWWWWWWWWWW |
---|---|---|---|
题目名称 | Sequence Construction | 最终得分 | 6 |
用户昵称 | LikableP | 运行时间 | 0.165 s |
代码语言 | C++ | 内存使用 | 1.75 MiB |
提交时间 | 2025-09-06 11:18:30 | ||
#include <cstdio> #include <ctime> int T; int M, K; int main() { freopen("Sequence.in", "r", stdin); freopen("Sequence.out", "w", stdout); scanf("%d", &T); while (T--) { bool ok = false; scanf("%d %d", &M, &K); for (int x = 0; x <= M; ++x) { if (clock() > 1900) break; int y = M - x; if ((__builtin_popcount(x) ^ __builtin_popcount(y)) == K) { ok = true; printf("2\n%d %d\n", x, y); break; } } if (!ok) { printf("-1\n"); } } return 0; }