Submission #69107373
Source Code Expand
import sys
sys.setrecursionlimit(10 ** 6)
# import numpy as np
# from numba import jit, boolean, int64, float64, typeof, types, typeof, objmode
def main():
from io import StringIO
execute(StringIO(sample), sys.stderr)
print("-- ^sample! --", file=sys.stderr)
execute(sys.stdin, sys.stdout)
# if len(solve.nopython_signatures) != 1:
# raise KeyboardInterrupt("!! Unexpected: wrong use of jit !!")
def execute(src, dst):
H, W = map(int, src.readline().split())
grid = [src.readline().strip() for _i in range(H)]
ans = solve(H, W, grid)
print(ans, file=dst)
sample = """\
8 7
.######
##....#
#.###.#
#.#.#.#
#.#.#.#
#.#####
#...#..
#####..
"""
def solve(H, W, grid):
row_blank = "." * (W+2)
inner = [ "." + s + "." for s in grid]
info = [row_blank] + inner + [row_blank]
for r in range(H+2) :
for c in range(W+2) :
if info[r][c] == "#":
cnt = 0
if info[r-1][c] == "#":
cnt += 1
if info[r][c-1] == "#":
cnt += 1
if info[r+1][c] == "#":
cnt += 1
if info[r][c+1] == "#":
cnt += 1
if cnt not in [2, 4]:
return "No"
return "Yes"
main()
Submission Info
| Submission Time | |
|---|---|
| Task | B - Looped Rope |
| User | tariaki |
| Language | Python (CPython 3.11.4) |
| Score | 200 |
| Code Size | 1391 Byte |
| Status | AC |
| Exec Time | 10 ms |
| Memory | 9016 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 | 10 ms | 8520 KiB |
| 00_sample_01.txt | AC | 10 ms | 8940 KiB |
| 00_sample_02.txt | AC | 10 ms | 8836 KiB |
| 00_sample_03.txt | AC | 10 ms | 8896 KiB |
| 01_random_04.txt | AC | 9 ms | 8944 KiB |
| 01_random_05.txt | AC | 10 ms | 8948 KiB |
| 01_random_06.txt | AC | 10 ms | 8944 KiB |
| 01_random_07.txt | AC | 10 ms | 9004 KiB |
| 01_random_08.txt | AC | 10 ms | 8940 KiB |
| 01_random_09.txt | AC | 10 ms | 8908 KiB |
| 01_random_10.txt | AC | 10 ms | 8864 KiB |
| 01_random_11.txt | AC | 10 ms | 8904 KiB |
| 01_random_12.txt | AC | 10 ms | 8916 KiB |
| 01_random_13.txt | AC | 10 ms | 8980 KiB |
| 02_handmade_14.txt | AC | 10 ms | 8840 KiB |
| 02_handmade_15.txt | AC | 10 ms | 9016 KiB |
| 02_handmade_16.txt | AC | 10 ms | 8960 KiB |
| 02_handmade_17.txt | AC | 10 ms | 8916 KiB |
| 02_handmade_18.txt | AC | 9 ms | 8920 KiB |
| 02_handmade_19.txt | AC | 10 ms | 8988 KiB |
| 02_handmade_20.txt | AC | 10 ms | 8840 KiB |
| 02_handmade_21.txt | AC | 10 ms | 8940 KiB |
| 02_handmade_22.txt | AC | 9 ms | 8944 KiB |
| 02_handmade_23.txt | AC | 10 ms | 8844 KiB |
| 02_handmade_24.txt | AC | 10 ms | 8968 KiB |