제출 #871612

#제출 시각아이디문제언어결과실행 시간메모리
871612TAhmed33Present (RMI21_present)C++98
0 / 100
2720 ms524288 KiB
#include <bits/stdc++.h> using namespace std; vector <vector <int>> dd; const int n = 35; vector <int> cur; int freq[n + 1]; void gen (int pos) { if (pos == n + 1) { dd.push_back(cur); reverse(dd.back().begin(), dd.back().end()); return; } gen(pos + 1); bool flag = 0; for (auto i : cur) { flag |= !freq[__gcd(pos, i)]; } if (flag) return; cur.push_back(pos); freq[pos] = 1; gen(pos + 1); cur.pop_back(); freq[pos] = 0; } int main () { gen(1); sort(dd.begin(), dd.end()); int t; cin >> t; while (t--) { int k; cin >> k; cout << dd[k].size() << " "; for (int i = dd[k].size() - 1; i >= 0; i--) { cout << dd[k][i] << " "; } cout << '\n'; } }
#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...