# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
944483 | 2024-03-12T18:51:59 Z | rainboy | 토마토 (KOI13_tomato) | C | 72 ms | 10628 KB |
#include <stdio.h> #define N 1000 #define M 1000 #define INF 0x3f3f3f3f int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } int main() { static int aa[N][M], dd[N][M]; int n, m, i, j, d; scanf("%d%d", &m, &n); for (i = 0; i < n; i++) for (j = 0; j < m; j++) scanf("%d", &aa[i][j]); for (i = 0; i < n; i++) for (j = 0; j < m; j++) dd[i][j] = aa[i][j] == 1 ? 0 : INF; for (i = 0; i < n; i++) { for (j = 1; j < m; j++) dd[i][j] = min(dd[i][j], dd[i][j - 1] + 1); for (j = m - 2; j >= 0; j--) dd[i][j] = min(dd[i][j], dd[i][j + 1] + 1); } for (j = 0; j < m; j++) { for (i = 1; i < n; i++) dd[i][j] = min(dd[i][j], dd[i - 1][j] + 1); for (i = n - 2; i >= 0; i--) dd[i][j] = min(dd[i][j], dd[i + 1][j] + 1); } d = 0; for (i = 0; i < n; i++) for (j = 0; j < m; j++) d = max(d, dd[i][j]); if (d == INF) d = -1; printf("%d\n", d); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2652 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3164 KB | Output is correct |
2 | Correct | 3 ms | 3164 KB | Output is correct |
3 | Correct | 1 ms | 2652 KB | Output is correct |
4 | Correct | 1 ms | 2480 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2744 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 3 ms | 7772 KB | Output is correct |
4 | Correct | 3 ms | 7768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3164 KB | Output is correct |
2 | Incorrect | 4 ms | 3332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 8280 KB | Output is correct |
2 | Incorrect | 16 ms | 8540 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 8540 KB | Output is correct |
2 | Correct | 26 ms | 8284 KB | Output is correct |
3 | Correct | 5 ms | 3164 KB | Output is correct |
4 | Correct | 6 ms | 2908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 8028 KB | Output is correct |
2 | Incorrect | 60 ms | 9872 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 10128 KB | Output is correct |
2 | Correct | 67 ms | 10204 KB | Output is correct |
3 | Incorrect | 71 ms | 10628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |