| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 737030 | jk410 | Present (RMI21_present) | C++17 | 1 ms | 452 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 T;
const int N = 8;
int gcd(int x, int y) {
	while (y) {
		int tmp = x % y;
		x = y;
		y = tmp;
	}
	return x;
}
bool check(int x) {
	vector<int> v;
	for (int i = 0; i < N; i++) {
		if (x & (1 << i))
			v.push_back(i + 1);
	}
	int sz = (int)v.size();
	for (int i = 0; i < sz; i++) {
		for (int j = i + 1; j < sz; j++) {
			if (!(x & (1 << gcd(v[i], v[j]) - 1)))
				return false;
		}
	}
	return true;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	vector<int> v;
	v.push_back(0);
	for (int i = 1; i < (1 << N); i++) {
		if (check(i))
			v.push_back(i);
	}
	cin >> T;
	while (T--) {
		int k;
		cin >> k;
		k = v[k];
		vector<int> ans;
		for (int i = 0; i < N; i++) {
			if (k & (1 << i))
				ans.push_back(i + 1);
		}
		cout << (int)ans.size() << " ";
		for (int i : ans)
			cout << i << " ";
		cout << "\n";
	}
	return 0;
}
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... | ||||
