# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480031 | 2021-10-14T12:00:52 Z | rainboy | Lutrija (COCI19_lutrija) | C | 579 ms | 324 KB |
#include <stdio.h> int prime(long long p) { long long a; if (p <= 1) return 0; for (a = 2; a <= p / a; a++) if (p % a == 0) return 0; return 1; } int main() { long long a, b; scanf("%lld%lld", &a, &b); if (a != 2 && !prime(a - 2) && !prime(a + 2) || b != 2 && !prime(b - 2) && !prime(b + 2)) printf("-1\n"); else { int cnt = 1; if (prime(a - 2)) cnt++; else if (prime(a + 2)) cnt += 2; if (prime(b - 2)) cnt++; else if (prime(b + 2)) cnt += 2; printf("%d\n", cnt); if (prime(a - 2)) printf("%lld ", a); else if (prime(a + 2)) printf("%lld %lld ", a, a + 2); printf("2"); if (prime(b - 2)) printf(" %lld", b); else if (prime(b + 2)) printf(" %lld %lld", b + 2, b); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 272 KB | Output is correct |
2 | Correct | 1 ms | 272 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 491 ms | 260 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 579 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 468 ms | 252 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 419 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 516 ms | 324 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 388 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 378 ms | 268 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 138 ms | 260 KB | Output is correct |