QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#358465 | #8174. Set Construction | SolitaryDream# | WA | 15ms | 20852kb | C++17 | 1.1kb | 2024-03-19 20:00:59 | 2024-03-19 20:01:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 60 * 61 / 2 + 1;
struct Sol {
int n;
vector<int> val;
};
Sol ans[M];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
ans[2] = {1, {0, 1}};
for (int i = 3; i < M; ++i)
if (i & 1) {
ans[i].n = ans[i - 1].n + 1;
int q = ans[i].n - 1;
for (auto x : ans[i - 1].val) {
ans[i].val.push_back(x << 1 | bool(x));
}
ans[i].val.push_back(1);
} else {
ans[i].n = ans[i / 2].n + 1;
for (auto x : ans[i / 2].val) {
ans[i].val.push_back(x << 1);
ans[i].val.push_back(x << 1 | 1);
}
}
int Case;
cin >> Case;
while (Case--) {
int n, m;
cin >> n >> m;
int del = n - ans[m].n;
for (auto x : ans[m].val) {
int rst = x << del | (x & 1 ? (1ll << del) - 1 : 0);
cout << rst << ' ';
}
cout << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 20852kb
input:
3 3 5 4 8 60 2
output:
0 3 5 7 1 0 3 4 7 8 11 12 15 0 1152921504606846975
result:
ok AC
Test #2:
score: 0
Accepted
time: 0ms
memory: 20740kb
input:
30 6 2 6 3 6 4 6 5 6 6 6 7 6 8 6 9 6 10 6 11 6 12 6 13 6 14 6 15 6 16 6 17 6 18 6 19 6 20 6 21 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 10 7 11
output:
0 63 0 63 31 0 31 32 63 0 31 47 63 15 0 15 48 63 16 31 0 15 55 63 23 31 7 0 15 16 31 32 47 48 63 0 15 23 31 39 47 55 63 7 0 7 24 31 40 47 56 63 8 15 0 7 27 31 43 47 59 63 11 15 3 0 7 8 15 48 55 56 63 16 23 24 31 0 7 11 15 51 55 59 63 19 23 27 31 3 0 3 12 15 52 55 60 63 20 23 28 31 4 7 0...
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 20696kb
input:
30 7 12 7 13 7 14 7 15 7 16 7 17 7 18 7 19 7 20 7 21 7 22 7 23 7 24 7 25 7 26 7 27 7 28 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 8 10 8 11 8 12 8 13 8 14
output:
0 15 16 31 96 111 112 127 32 47 48 63 0 15 23 31 103 111 119 127 39 47 55 63 7 0 7 24 31 104 111 120 127 40 47 56 63 8 15 0 7 27 31 107 111 123 127 43 47 59 63 11 15 3 0 15 16 31 32 47 48 63 64 79 80 95 96 111 112 127 0 15 23 31 39 47 55 63 71 79 87 95 103 111 119 127 7 0 7 24 31 40 47 56 63 7...
result:
ok AC
Test #4:
score: 0
Accepted
time: 0ms
memory: 20740kb
input:
30 8 15 8 16 8 17 8 18 8 19 8 20 8 21 8 22 8 23 8 24 8 25 8 26 8 27 8 28 8 29 8 30 8 31 8 32 8 33 8 34 8 35 8 36 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9
output:
0 15 55 63 215 223 247 255 87 95 119 127 23 31 7 0 31 32 63 64 95 96 127 128 159 160 191 192 223 224 255 0 31 47 63 79 95 111 127 143 159 175 191 207 223 239 255 15 0 15 48 63 80 95 112 127 144 159 176 191 208 223 240 255 16 31 0 15 55 63 87 95 119 127 151 159 183 191 215 223 247 255 23 31 7 0 ...
result:
ok AC
Test #5:
score: 0
Accepted
time: 8ms
memory: 20780kb
input:
30 9 10 9 11 9 12 9 13 9 14 9 15 9 16 9 17 9 18 9 19 9 20 9 21 9 22 9 23 9 24 9 25 9 26 9 27 9 28 9 29 9 30 9 31 9 32 9 33 9 34 9 35 9 36 9 37 9 38 9 39
output:
0 63 192 255 320 383 448 511 64 127 0 63 223 255 351 383 479 511 95 127 31 0 63 64 127 384 447 448 511 128 191 192 255 0 63 95 127 415 447 479 511 159 191 223 255 31 0 31 96 127 416 447 480 511 160 191 224 255 32 63 0 31 111 127 431 447 495 511 175 191 239 255 47 63 15 0 63 64 127 128 191 192 ...
result:
ok AC
Test #6:
score: 0
Accepted
time: 0ms
memory: 20752kb
input:
6 9 40 9 41 9 42 9 43 9 44 9 45
output:
0 15 16 31 32 47 48 63 192 207 208 223 224 239 240 255 320 335 336 351 352 367 368 383 448 463 464 479 480 495 496 511 64 79 80 95 96 111 112 127 0 15 23 31 39 47 55 63 199 207 215 223 231 239 247 255 327 335 343 351 359 367 375 383 455 463 471 479 487 495 503 511 71 79 87 95 103 111 119 127 7 0 7...
result:
ok AC
Test #7:
score: 0
Accepted
time: 15ms
memory: 20704kb
input:
30 60 1801 60 1802 60 1803 60 1804 60 1805 60 1806 60 1807 60 1808 60 1809 60 1810 60 1811 60 1812 60 1813 60 1814 60 1815 60 1816 60 1817 60 1818 60 1819 60 1820 60 1821 60 1822 60 1823 60 1824 60 1825 60 1826 60 1827 60 1828 60 1829 60 1830
output:
0 281474976710655 422212465065983 562949953421311 703687441776639 844424930131967 985162418487295 1125899906842623 3518437208883199 3659174697238527 3799912185593855 3940649673949183 4081387162304511 4222124650659839 4362862139015167 4503599627370495 5770237022568447 5910974510923775 605171199927910...
result:
ok AC
Test #8:
score: 0
Accepted
time: 7ms
memory: 20756kb
input:
30 59 1741 59 1742 59 1743 59 1744 59 1745 59 1746 59 1747 59 1748 59 1749 59 1750 59 1751 59 1752 59 1753 59 1754 59 1755 59 1756 59 1757 59 1758 59 1759 59 1760 59 1761 59 1762 59 1763 59 1764 59 1765 59 1766 59 1767 59 1768 59 1769 59 1770
output:
0 35184372088831 52776558133247 70368744177663 228698418577407 246290604621823 263882790666239 281474976710655 932385860354047 949978046398463 967570232442879 985162418487295 1073123348709375 1090715534753791 1108307720798207 1125899906842623 1495335813775359 1512927999819775 1530520185864191 154811...
result:
ok AC
Test #9:
score: 0
Accepted
time: 5ms
memory: 20756kb
input:
30 58 1682 58 1683 58 1684 58 1685 58 1686 58 1687 58 1688 58 1689 58 1690 58 1691 58 1692 58 1693 58 1694 58 1695 58 1696 58 1697 58 1698 58 1699 58 1700 58 1701 58 1702 58 1703 58 1704 58 1705 58 1706 58 1707 58 1708 58 1709 58 1710 58 1711
output:
0 35184372088831 105553116266496 140737488355327 175921860444160 211106232532991 246290604621824 281474976710655 316659348799488 351843720888319 387028092977152 422212465065983 457396837154816 492581209243647 527765581332480 562949953421311 1724034232352768 1759218604441599 1794402976530432 18295873...
result:
ok AC
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 20780kb
input:
30 2 2 2 3 3 2 3 3 3 4 3 5 3 6 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 4 10 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15
output:
0 3 0 3 1 0 7 0 7 3 0 3 4 7 0 3 5 7 1 0 1 6 7 2 3 0 15 0 15 7 0 7 8 15 0 7 11 15 3 0 3 12 15 4 7 0 3 13 15 5 7 1 0 3 4 7 8 11 12 15 0 3 5 7 9 11 13 15 1 0 1 6 7 10 11 14 15 2 3 0 31 0 31 15 0 15 16 31 0 15 23 31 7 0 7 24 31 8 15 0 7 27 31 11 15 3 0 7 8 15 16 23 24 31 0 7 11 15...
result:
wrong answer Integer element [index=2] equals to -1, violates the range [0, 31]