| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 869255 | MinaRagy06 | Present (RMI21_present) | C++17 | 2 ms | 604 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;
typedef int64_t ll;
const int N = 12;
vector<vector<int>> all;
bool check(vector<int> v) {
	bool ok[N + 1]{};
	for (auto i : v) ok[i] = 1;
	for (int i = 0; i < v.size(); i++) {
		for (int j = i + 1; j < v.size(); j++) {
			if (!ok[gcd(v[i], v[j])]) return 0;
		}
	}
	return 1;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	for (int msk = 0; msk < (1 << N); msk++) {
		vector<int> v;
		for (int j = N - 1; j >= 0; j--) {
			if ((msk >> j) & 1) v.push_back(j + 1);
		}
		if (check(v)) all.push_back(v);
	}
	sort(all.begin(), all.end());
	int t;
	cin >> t;
	while (t--) {
		int k;
		cin >> k;
		cout << all[k].size() << ' ';
		for (int j = all[k].size() - 1; j >= 0; j--) {
			cout << all[k][j] << ' ';
		}
		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... | ||||
