#include <bits/stdc++.h>
using namespace std;
vector <vector <int>> dd;
const int n = 15;
int main () {
for (int i = 0; i < (1 << n); i++) {
vector <int> x;
int freq[n + 1] = {};
for (int j = 0; j < n; j++) {
if ((i >> j) & 1) {
freq[j + 1] = 1;
x.push_back(j + 1);
}
}
bool flag = 0;
for (int i = 0; i < n; i++) for (int j = 1; j < n; j++) {
if (freq[i + 1] && freq[j + 1]) flag |= !freq[__gcd(i + 1, j + 1)];
}
if (flag) continue;
reverse(x.begin(), x.end());
dd.push_back(x);
}
sort(dd.begin(), dd.end());
int t;
cin >> t;
while (t--) {
int k;
cin >> k;
cout << dd[k].size() << " ";
reverse(dd[k].begin(), dd[k].end());
for (auto j : dd[k]) cout << j << " ";
cout << '\n';
reverse(dd[k].begin(), dd[k].end());
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
872 KB |
Output is correct |
2 |
Correct |
33 ms |
604 KB |
Output is correct |
3 |
Correct |
33 ms |
604 KB |
Output is correct |
4 |
Correct |
33 ms |
832 KB |
Output is correct |
5 |
Correct |
33 ms |
832 KB |
Output is correct |
6 |
Correct |
33 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
872 KB |
Output is correct |
2 |
Correct |
33 ms |
604 KB |
Output is correct |
3 |
Correct |
33 ms |
604 KB |
Output is correct |
4 |
Correct |
33 ms |
832 KB |
Output is correct |
5 |
Correct |
33 ms |
832 KB |
Output is correct |
6 |
Correct |
33 ms |
600 KB |
Output is correct |
7 |
Runtime error |
34 ms |
1608 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
872 KB |
Output is correct |
2 |
Correct |
33 ms |
604 KB |
Output is correct |
3 |
Correct |
33 ms |
604 KB |
Output is correct |
4 |
Correct |
33 ms |
832 KB |
Output is correct |
5 |
Correct |
33 ms |
832 KB |
Output is correct |
6 |
Correct |
33 ms |
600 KB |
Output is correct |
7 |
Runtime error |
34 ms |
1608 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
872 KB |
Output is correct |
2 |
Correct |
33 ms |
604 KB |
Output is correct |
3 |
Correct |
33 ms |
604 KB |
Output is correct |
4 |
Correct |
33 ms |
832 KB |
Output is correct |
5 |
Correct |
33 ms |
832 KB |
Output is correct |
6 |
Correct |
33 ms |
600 KB |
Output is correct |
7 |
Runtime error |
34 ms |
1608 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
872 KB |
Output is correct |
2 |
Correct |
33 ms |
604 KB |
Output is correct |
3 |
Correct |
33 ms |
604 KB |
Output is correct |
4 |
Correct |
33 ms |
832 KB |
Output is correct |
5 |
Correct |
33 ms |
832 KB |
Output is correct |
6 |
Correct |
33 ms |
600 KB |
Output is correct |
7 |
Runtime error |
34 ms |
1608 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |