提出 #69103305


ソースコード 拡げる

h, w = map(int, input().split())
s = [input() for _ in range(h)]

di = [0, 0, 1, -1]
dj = [-1, 1, 0, 0]
for i in range(h):
    for j in range(w):
        if s[i][j] != "#":
            continue
        cnt = 0
        for k in range(4):
            ni = di[k] + i
            nj = dj[k] + j
            if 0 <= ni < h and 0 <= nj < w:
                if s[ni][nj] == "#":
                    cnt += 1
        if not (cnt == 2 or cnt == 4):
            print("No")
            exit()
print("Yes")

提出情報

提出日時
問題 B - Looped Rope
ユーザ suidonx
言語 Python (PyPy 3.10-v7.3.12)
得点 200
コード長 516 Byte
結果 AC
実行時間 57 ms
メモリ 76740 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 4
AC × 25
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 55 ms 76436 KiB
00_sample_01.txt AC 55 ms 76628 KiB
00_sample_02.txt AC 55 ms 76392 KiB
00_sample_03.txt AC 56 ms 76360 KiB
01_random_04.txt AC 55 ms 76332 KiB
01_random_05.txt AC 55 ms 76544 KiB
01_random_06.txt AC 55 ms 76620 KiB
01_random_07.txt AC 56 ms 76508 KiB
01_random_08.txt AC 56 ms 76632 KiB
01_random_09.txt AC 56 ms 76308 KiB
01_random_10.txt AC 55 ms 76300 KiB
01_random_11.txt AC 55 ms 76300 KiB
01_random_12.txt AC 55 ms 76740 KiB
01_random_13.txt AC 57 ms 76536 KiB
02_handmade_14.txt AC 56 ms 76660 KiB
02_handmade_15.txt AC 56 ms 76568 KiB
02_handmade_16.txt AC 56 ms 76712 KiB
02_handmade_17.txt AC 56 ms 76528 KiB
02_handmade_18.txt AC 56 ms 76308 KiB
02_handmade_19.txt AC 55 ms 76320 KiB
02_handmade_20.txt AC 55 ms 76676 KiB
02_handmade_21.txt AC 56 ms 76464 KiB
02_handmade_22.txt AC 56 ms 76212 KiB
02_handmade_23.txt AC 55 ms 76452 KiB
02_handmade_24.txt AC 55 ms 76732 KiB