# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685828 | QwertyPi | Present (RMI21_present) | C++14 | 4066 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
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 % 1000000 == 0) cout << i << ' ' << cnt << endl; cnt++; }
}
*/
int L; cin >> L;
for(int i = 0; i < L; i++){
int x; cin >> x;
B = 0;
for(int i = 0; ; i++){
while(i >= (1ULL << B)) B++;
if(ok(i)) { if(x == 0) { out(i); break; } x--; }
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |