QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528068 | #2809. Present | nhuang685# | 8 | 1ms | 3648kb | C++20 | 908b | 2024-08-23 06:37:49 | 2024-08-23 06:37:49 |
answer
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
const int LG = 8;
std::vector<std::set<int, std::greater<>>> good;
for (int i = 0; i < (1 << LG); ++i) {
std::set<int, std::greater<>> ele;
for (int j = 0; j < LG; ++j) {
if (((1 << j) & i) != 0) {
ele.insert(LG - j);
}
}
if (std::all_of(ele.begin(), ele.end(), [&](int v) {
return std::all_of(ele.begin(), ele.end(), [&](int v2) {
return ele.contains(std::gcd(v, v2));
});
}))
{
good.push_back(ele);
}
}
std::sort(good.begin(), good.end());
int t;
std::cin >> t;
while ((t--) != 0) {
int k;
std::cin >> k;
std::cout << good[k].size();
for (int i : good[k] | std::views::reverse) {
std::cout << ' ' << i;
}
std::cout << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 1ms
memory: 3648kb
input:
5 62 37 88 57 72
output:
5 1 2 5 6 7 6 1 2 3 4 5 6 4 1 2 6 8 4 1 3 6 7 4 1 2 3 8
result:
ok 5 lines
Test #2:
score: 8
Accepted
time: 0ms
memory: 3636kb
input:
5 88 77 21 87 24
output:
4 1 2 6 8 4 1 3 4 8 5 1 2 3 4 5 3 2 6 8 2 2 6
result:
ok 5 lines
Test #3:
score: 8
Accepted
time: 0ms
memory: 3636kb
input:
5 59 5 72 76 95
output:
5 1 2 4 6 7 2 1 3 4 1 2 3 8 4 1 2 4 8 6 1 2 4 5 6 8
result:
ok 5 lines
Test #4:
score: 8
Accepted
time: 1ms
memory: 3632kb
input:
5 3 58 50 91 38
output:
2 1 2 5 1 2 3 6 7 5 1 2 3 5 7 5 1 2 4 6 8 1 7
result:
ok 5 lines
Test #5:
score: 8
Accepted
time: 1ms
memory: 3636kb
input:
5 6 38 78 60 52
output:
3 1 2 3 1 7 5 1 2 3 4 8 6 1 2 3 4 6 7 5 1 2 4 5 7
result:
ok 5 lines
Test #6:
score: 8
Accepted
time: 1ms
memory: 3640kb
input:
5 53 2 54 17 77
output:
5 1 3 4 5 7 1 2 6 1 2 3 4 5 7 4 1 2 3 5 4 1 3 4 8
result:
ok 5 lines
Subtask #2:
score: 0
Runtime Error
Dependency #1:
100%
Accepted
Test #7:
score: 0
Runtime Error
input:
5 967473 149056 95798 903699 54343
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%