#include <bits/stdc++.h>
using namespace std;
vector <vector <int>> dd;
const int n = 20;
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());
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1774 ms |
8832 KB |
Output is correct |
2 |
Correct |
1774 ms |
8696 KB |
Output is correct |
3 |
Correct |
1785 ms |
8628 KB |
Output is correct |
4 |
Correct |
1784 ms |
8952 KB |
Output is correct |
5 |
Correct |
1779 ms |
8888 KB |
Output is correct |
6 |
Correct |
1780 ms |
8952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1774 ms |
8832 KB |
Output is correct |
2 |
Correct |
1774 ms |
8696 KB |
Output is correct |
3 |
Correct |
1785 ms |
8628 KB |
Output is correct |
4 |
Correct |
1784 ms |
8952 KB |
Output is correct |
5 |
Correct |
1779 ms |
8888 KB |
Output is correct |
6 |
Correct |
1780 ms |
8952 KB |
Output is correct |
7 |
Runtime error |
1785 ms |
18116 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1774 ms |
8832 KB |
Output is correct |
2 |
Correct |
1774 ms |
8696 KB |
Output is correct |
3 |
Correct |
1785 ms |
8628 KB |
Output is correct |
4 |
Correct |
1784 ms |
8952 KB |
Output is correct |
5 |
Correct |
1779 ms |
8888 KB |
Output is correct |
6 |
Correct |
1780 ms |
8952 KB |
Output is correct |
7 |
Runtime error |
1785 ms |
18116 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1774 ms |
8832 KB |
Output is correct |
2 |
Correct |
1774 ms |
8696 KB |
Output is correct |
3 |
Correct |
1785 ms |
8628 KB |
Output is correct |
4 |
Correct |
1784 ms |
8952 KB |
Output is correct |
5 |
Correct |
1779 ms |
8888 KB |
Output is correct |
6 |
Correct |
1780 ms |
8952 KB |
Output is correct |
7 |
Runtime error |
1785 ms |
18116 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1774 ms |
8832 KB |
Output is correct |
2 |
Correct |
1774 ms |
8696 KB |
Output is correct |
3 |
Correct |
1785 ms |
8628 KB |
Output is correct |
4 |
Correct |
1784 ms |
8952 KB |
Output is correct |
5 |
Correct |
1779 ms |
8888 KB |
Output is correct |
6 |
Correct |
1780 ms |
8952 KB |
Output is correct |
7 |
Runtime error |
1785 ms |
18116 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |