Submission #69375921
Source Code Expand
Copy
#include <stdio.h>int H, W;char S[2048][2048];int main(void) {int i, j;if (scanf("%d%d", &H, &W) != 2) return 1;for (i = 1; i <= H; i++) {if (scanf("%2046s", S[i] + 1) != 1) return 1;}for (i = 1; i <= H; i++) {for (j = 1; j <= W; j++) {if (S[i][j] == '#') {int cnt = (S[i][j - 1] == '#') + (S[i][j + 1] == '#') +(S[i - 1][j] == '#') + (S[i + 1][j] == '#');if (cnt != 2 && cnt != 4) {puts("No");return 0;}}
#include <stdio.h>
int H, W;
char S[2048][2048];
int main(void) {
int i, j;
if (scanf("%d%d", &H, &W) != 2) return 1;
for (i = 1; i <= H; i++) {
if (scanf("%2046s", S[i] + 1) != 1) return 1;
}
for (i = 1; i <= H; i++) {
for (j = 1; j <= W; j++) {
if (S[i][j] == '#') {
int cnt = (S[i][j - 1] == '#') + (S[i][j + 1] == '#') +
(S[i - 1][j] == '#') + (S[i + 1][j] == '#');
if (cnt != 2 && cnt != 4) {
puts("No");
return 0;
}
}
}
}
puts("Yes");
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Looped Rope |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 200 |
| Code Size | 528 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 1644 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_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, 02_handmade_14.txt, 02_handmade_15.txt, 02_handmade_16.txt, 02_handmade_17.txt, 02_handmade_18.txt, 02_handmade_19.txt, 02_handmade_20.txt, 02_handmade_21.txt, 02_handmade_22.txt, 02_handmade_23.txt, 02_handmade_24.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 1592 KiB |
| 00_sample_01.txt | AC | 1 ms | 1580 KiB |
| 00_sample_02.txt | AC | 1 ms | 1584 KiB |
| 00_sample_03.txt | AC | 0 ms | 1552 KiB |
| 01_random_04.txt | AC | 0 ms | 1624 KiB |
| 01_random_05.txt | AC | 0 ms | 1608 KiB |
| 01_random_06.txt | AC | 0 ms | 1508 KiB |
| 01_random_07.txt | AC | 0 ms | 1572 KiB |
| 01_random_08.txt | AC | 1 ms | 1640 KiB |
| 01_random_09.txt | AC | 1 ms | 1612 KiB |
| 01_random_10.txt | AC | 1 ms | 1584 KiB |
| 01_random_11.txt | AC | 0 ms | 1628 KiB |
| 01_random_12.txt | AC | 0 ms | 1624 KiB |
| 01_random_13.txt | AC | 0 ms | 1628 KiB |
| 02_handmade_14.txt | AC | 1 ms | 1576 KiB |
| 02_handmade_15.txt | AC | 0 ms | 1624 KiB |
| 02_handmade_16.txt | AC | 0 ms | 1628 KiB |
| 02_handmade_17.txt | AC | 0 ms | 1524 KiB |
| 02_handmade_18.txt | AC | 1 ms | 1576 KiB |
| 02_handmade_19.txt | AC | 1 ms | 1556 KiB |
| 02_handmade_20.txt | AC | 1 ms | 1552 KiB |
| 02_handmade_21.txt | AC | 0 ms | 1632 KiB |
| 02_handmade_22.txt | AC | 0 ms | 1584 KiB |
| 02_handmade_23.txt | AC | 0 ms | 1644 KiB |
| 02_handmade_24.txt | AC | 1 ms | 1612 KiB |