# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
794719 | 2023-07-26T20:01:15 Z | rainboy | Present (RMI21_present) | C | 235 ms | 4144 KB |
#include <stdio.h> #define N 1000000 #define A 25 int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int good(int s, int b) { int a; for (a = 1; a < b; a++) if ((s & 1 << a) != 0 && (s & 1 << gcd(a, b)) == 0) return 0; return 1; } int main() { static int ss[N + 1]; int t, n, i, a; scanf("%d", &t); n = 0; ss[n++] = 0; for (a = 1; a <= A; a++) for (i = 0; i < n && n <= N; i++) if ((ss[i] & 1 << a) == 0 && good(ss[i], a)) ss[n++] = ss[i] | 1 << a; printf("%d\n", n); while (t--) { int cnt; scanf("%d", &i); cnt = 0; for (a = 1; a <= A; a++) if ((ss[i] & 1 << a) != 0) cnt++; printf("%d", cnt); for (a = 1; a <= A; a++) if ((ss[i] & 1 << a) != 0) printf(" %d", a); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 4144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 4144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 4144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 4144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 235 ms | 4144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |