Submission #871602

#TimeUsernameProblemLanguageResultExecution timeMemory
871602TAhmed33Present (RMI21_present)C++98
8 / 100
37 ms1608 KiB
#include <bits/stdc++.h> using namespace std; vector <vector <int>> dd; const int n = 15; int main () { for (int i = 0; i < (1 << n); i++) { vector <int> x; int freq[n + 1] = {}; for (int j = 0; j < n; j++) { if ((i >> j) & 1) { freq[j + 1] = 1; x.push_back(j + 1); } } bool flag = 0; for (int i = 0; i < n; i++) for (int j = 1; j < n; j++) { if (freq[i + 1] && freq[j + 1]) flag |= !freq[__gcd(i + 1, j + 1)]; } if (flag) continue; reverse(x.begin(), x.end()); dd.push_back(x); } sort(dd.begin(), dd.end()); int t; cin >> t; while (t--) { int k; cin >> k; cout << dd[k].size() << " "; reverse(dd[k].begin(), dd[k].end()); for (auto j : dd[k]) cout << j << " "; cout << '\n'; reverse(dd[k].begin(), dd[k].end()); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...