#include <bits/stdc++.h>
using namespace std;
int g[65][65];
int B = 1;
bool ok(uint64_t b){
for(int i = 1; i < B; i++){
for(int j = i; j < B; j++){
if((b & (1ULL << i)) && (b & (1ULL << j)) && !(b & (1ULL << g[i][j]))) return false;
}
}
return true;
}
void out(uint64_t b){
vector<int> v;
for(int i = 0; i < 64; i++){
if(b & (1ULL << i)) v.push_back(i + 1);
}
cout << v.size() << ' ';
for(auto i : v) cout << i << ' ';
cout << endl;
}
const int ST = 100000;
int a[11] = {0, 925799, 2372147, 3730271, 4916863, 6415551, 7643727, 9564415, 12028927, 14427903};
int main(){
for(int i = 1; i <= 64; i++) for(int j = 1; j <= 64; j++) g[i - 1][j - 1] = __gcd(i, j) - 1;
int cnt = 0;
/*
for(int i = 0;; i++){
while(i >= (1ULL << B)) B++;
if(ok(i)) { if(cnt % 100000 == 0) cout << i << ", "; cnt++; }
if(cnt >= 1000000) break;
}
*/
int L; cin >> L;
for(int i = 0; i < L; i++){
int x, y = 0; cin >> x;
B = 0;
y = a[x / ST], x %= ST;
for(; ; y++){
while(y >= (1ULL << B)) B++;
if(ok(y)) { if(x == 0) { out(y); break; } x--; }
}
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:45:21: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
45 | while(y >= (1ULL << B)) B++;
| ~~^~~~~~~~~~~~~~
Main.cpp:30:9: warning: unused variable 'cnt' [-Wunused-variable]
30 | int cnt = 0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
452 ms |
288 KB |
Output is correct |
8 |
Correct |
521 ms |
296 KB |
Output is correct |
9 |
Correct |
304 ms |
212 KB |
Output is correct |
10 |
Correct |
749 ms |
292 KB |
Output is correct |
11 |
Correct |
616 ms |
212 KB |
Output is correct |
12 |
Correct |
460 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
452 ms |
288 KB |
Output is correct |
8 |
Correct |
521 ms |
296 KB |
Output is correct |
9 |
Correct |
304 ms |
212 KB |
Output is correct |
10 |
Correct |
749 ms |
292 KB |
Output is correct |
11 |
Correct |
616 ms |
212 KB |
Output is correct |
12 |
Correct |
460 ms |
212 KB |
Output is correct |
13 |
Incorrect |
246 ms |
212 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
452 ms |
288 KB |
Output is correct |
8 |
Correct |
521 ms |
296 KB |
Output is correct |
9 |
Correct |
304 ms |
212 KB |
Output is correct |
10 |
Correct |
749 ms |
292 KB |
Output is correct |
11 |
Correct |
616 ms |
212 KB |
Output is correct |
12 |
Correct |
460 ms |
212 KB |
Output is correct |
13 |
Incorrect |
246 ms |
212 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
452 ms |
288 KB |
Output is correct |
8 |
Correct |
521 ms |
296 KB |
Output is correct |
9 |
Correct |
304 ms |
212 KB |
Output is correct |
10 |
Correct |
749 ms |
292 KB |
Output is correct |
11 |
Correct |
616 ms |
212 KB |
Output is correct |
12 |
Correct |
460 ms |
212 KB |
Output is correct |
13 |
Incorrect |
246 ms |
212 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |