Submission #66426276
Source Code Expand
Copy
#include <stdio.h>int H, W;char S[1024][1024];const int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};int q[1024 * 1024][2];int main(void) {int i, j;int qs = 0, qe = 0;if (scanf("%d%d", &H, &W) != 2) return 1;for (i = 1; i <= H; i++) {if (scanf("%1022s", S[i] + 1) != 1) return 1;}for (i = 1; i <= H; i++) {for (j = 1; j <= W; j++) {if (S[i][j] == 'E') {q[qe][0] = i;q[qe][1] = j;
#include <stdio.h>
int H, W;
char S[1024][1024];
const int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int q[1024 * 1024][2];
int main(void) {
int i, j;
int qs = 0, qe = 0;
if (scanf("%d%d", &H, &W) != 2) return 1;
for (i = 1; i <= H; i++) {
if (scanf("%1022s", S[i] + 1) != 1) return 1;
}
for (i = 1; i <= H; i++) {
for (j = 1; j <= W; j++) {
if (S[i][j] == 'E') {
q[qe][0] = i;
q[qe][1] = j;
qe++;
}
}
}
while (qs < qe) {
int cy = q[qs][0], cx = q[qs][1];
qs++;
for (i = 0; i < 4; i++) {
int ny = cy + d[i][0], nx = cx + d[i][1];
if (S[ny][nx] == '.') {
S[ny][nx] = "<>^v"[i];
q[qe][0] = ny;
q[qe][1] = nx;
qe++;
}
}
}
for (i = 1; i <= H; i++) {
puts(S[i] + 1);
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Escape Route |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 400 |
| Code Size | 798 Byte |
| Status | AC |
| Exec Time | 22 ms |
| Memory | 10380 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 02_corner_04.txt, 02_corner_05.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 0 ms | 1648 KiB |
| 00_sample_01.txt | AC | 0 ms | 1504 KiB |
| 00_sample_02.txt | AC | 0 ms | 1600 KiB |
| 01_random_00.txt | AC | 12 ms | 6748 KiB |
| 01_random_01.txt | AC | 11 ms | 6488 KiB |
| 01_random_02.txt | AC | 19 ms | 9456 KiB |
| 01_random_03.txt | AC | 17 ms | 10380 KiB |
| 01_random_04.txt | AC | 13 ms | 6800 KiB |
| 01_random_05.txt | AC | 15 ms | 7940 KiB |
| 01_random_06.txt | AC | 15 ms | 7196 KiB |
| 01_random_07.txt | AC | 20 ms | 10260 KiB |
| 01_random_08.txt | AC | 9 ms | 6888 KiB |
| 01_random_09.txt | AC | 9 ms | 7484 KiB |
| 01_random_10.txt | AC | 14 ms | 8664 KiB |
| 01_random_11.txt | AC | 22 ms | 10336 KiB |
| 01_random_12.txt | AC | 19 ms | 9672 KiB |
| 01_random_13.txt | AC | 15 ms | 10348 KiB |
| 01_random_14.txt | AC | 15 ms | 7948 KiB |
| 01_random_15.txt | AC | 19 ms | 10328 KiB |
| 02_corner_00.txt | AC | 9 ms | 6484 KiB |
| 02_corner_01.txt | AC | 4 ms | 2640 KiB |
| 02_corner_02.txt | AC | 12 ms | 6476 KiB |
| 02_corner_03.txt | AC | 1 ms | 1620 KiB |
| 02_corner_04.txt | AC | 1 ms | 2604 KiB |
| 02_corner_05.txt | AC | 11 ms | 8436 KiB |