# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
768802 | 2023-06-28T16:23:32 Z | rainboy | Nice sequence (IZhO18_sequence) | C | 1 ms | 296 KB |
#include <stdio.h> #define N 200000 #define M 200000 int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { int t; scanf("%d", &t); while (t--) { static int pp[N + M]; int n, m, d, n_, i, p; scanf("%d%d", &n, &m), d = gcd(n, m), n_ = m + n - d; i = n_, p = 0; while (1) { i = i >= n ? i - n : i + m; if (i == n_) break; pp[i] = p++; } for (i = 0; i < n_; i++) pp[i] = pp[i - i % d]; printf("%d\n", n_ - 1); for (i = 1; i < n_; i++) printf("%d ", pp[i] - pp[i - 1]); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Incorrect | 1 ms | 296 KB | All the numbers must be nonzero |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | All the numbers must be nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Ok |
2 | Correct | 0 ms | 212 KB | Ok |
3 | Incorrect | 0 ms | 212 KB | All the numbers must be nonzero |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | All the numbers must be nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Incorrect | 1 ms | 296 KB | All the numbers must be nonzero |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Incorrect | 1 ms | 296 KB | All the numbers must be nonzero |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Incorrect | 1 ms | 296 KB | All the numbers must be nonzero |
3 | Halted | 0 ms | 0 KB | - |