# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737042 | 2023-05-06T13:48:46 Z | mjhmjh1104 | Present (RMI21_present) | C++17 | 4000 ms | 8552 KB |
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int gcd(int x, int y) { if (!x || !y) return x + y; return x % y ? gcd(y, x % y) : y; } int g[26][26]; bool validate(const int &v) { for (int i = 0; i < 25; i++) if (v & 1 << i) for (int j = i + 1; j < 25; j++) if (v & 1 << j) { int k = g[i + 1][j + 1] - 1; if (~v & 1 << k) return false; } return true; } int t, k; vector<int> lt; int main() { for (int i = 0; i < 26; i++) for (int j = 0; j < 26; j++) g[i][j] = gcd(i, j); for (int i = 0; i < 1 << 25; i++) { if (!validate(i)) continue; lt.push_back(i); } sort(lt.begin(), lt.end(), [](const int &x, const int &y) { for (int i = 24; i >= 0; i--) if ((x & 1 << i) != (y & 1 << i)) return (x & 1 << i) < (y & 1 << i); return false; }); for (scanf("%d", &t); t--; ) { scanf("%d", &k); int &c = lt[k]; vector<int> v; for (int i = 0; i < 25; i++) if (c & 1 << i) v.push_back(i + 1); printf("%d ", (int)v.size()); for (auto &i: v) printf("%d ", i); puts(""); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 8552 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 8552 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 8552 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 8552 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 8552 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |