#include <bits/stdc++.h>
#ifdef BLAT
#include "debug/debug.hpp"
#else
#define debug(x...)
#endif
using namespace std;
void generateNextSet(long long &mask) {
for (int i = 1; i <= 40; i++) {
mask ^= (1LL << i);
if (mask & (1LL << i))
break;
}
long long gcd = 0;
for (int i = 1; i <= 40; i++)
for (int j = i + 1; j <= 40; j++)
if ((mask & (1LL << i)) && (mask & (1LL << j)))
gcd |= (1LL << (__gcd(i, j)));
for (int i = 40; i >= 1; i--)
if (gcd & (1LL << i))
mask |= (1LL << i);
}
void printSet(long long set, int setidx) {
// cout << "S" << setidx << " = ";
cout << __builtin_popcountll(set) << ' ';
for (int i = 1; i <= 40; i++)
if (set & (1LL << i))
cout << i << ' ';
cout << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long set = 2;
vector <long long> sets = {0};
for (int i = 1; i <= 1000000; i++) {
sets.push_back(set);
generateNextSet(set);
}
int t;
cin >> t;
while (t--) {
int k;
cin >> k;
printSet(sets[k], k);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
8844 KB |
Output is correct |
2 |
Correct |
1473 ms |
8784 KB |
Output is correct |
3 |
Correct |
1462 ms |
8724 KB |
Output is correct |
4 |
Correct |
1464 ms |
8692 KB |
Output is correct |
5 |
Correct |
1463 ms |
8736 KB |
Output is correct |
6 |
Correct |
1469 ms |
8728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
8844 KB |
Output is correct |
2 |
Correct |
1473 ms |
8784 KB |
Output is correct |
3 |
Correct |
1462 ms |
8724 KB |
Output is correct |
4 |
Correct |
1464 ms |
8692 KB |
Output is correct |
5 |
Correct |
1463 ms |
8736 KB |
Output is correct |
6 |
Correct |
1469 ms |
8728 KB |
Output is correct |
7 |
Incorrect |
1477 ms |
8668 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
8844 KB |
Output is correct |
2 |
Correct |
1473 ms |
8784 KB |
Output is correct |
3 |
Correct |
1462 ms |
8724 KB |
Output is correct |
4 |
Correct |
1464 ms |
8692 KB |
Output is correct |
5 |
Correct |
1463 ms |
8736 KB |
Output is correct |
6 |
Correct |
1469 ms |
8728 KB |
Output is correct |
7 |
Incorrect |
1477 ms |
8668 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
8844 KB |
Output is correct |
2 |
Correct |
1473 ms |
8784 KB |
Output is correct |
3 |
Correct |
1462 ms |
8724 KB |
Output is correct |
4 |
Correct |
1464 ms |
8692 KB |
Output is correct |
5 |
Correct |
1463 ms |
8736 KB |
Output is correct |
6 |
Correct |
1469 ms |
8728 KB |
Output is correct |
7 |
Incorrect |
1477 ms |
8668 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1470 ms |
8844 KB |
Output is correct |
2 |
Correct |
1473 ms |
8784 KB |
Output is correct |
3 |
Correct |
1462 ms |
8724 KB |
Output is correct |
4 |
Correct |
1464 ms |
8692 KB |
Output is correct |
5 |
Correct |
1463 ms |
8736 KB |
Output is correct |
6 |
Correct |
1469 ms |
8728 KB |
Output is correct |
7 |
Incorrect |
1477 ms |
8668 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |