Submission #737025

# Submission time Handle Problem Language Result Execution time Memory
737025 2023-05-06T13:28:26 Z jk410 Present (RMI21_present) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
int T;
const int N = 10;
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]))))
				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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -