Please sign in first.
Submission #75849365
Source Code Expand
dir = [[-1, 0], [0, 1], [1, 0], [0, -1]]
H, W = map(int, input().split())
ans = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
cnt = 0
for dy, dx in dir:
ny = i + dy
nx = j + dx
if 0 <= ny < H and 0 <= nx < W:
cnt += 1
ans[i][j] = cnt
for a in ans:
print(*a)
Submission Info
| Submission Time | |
|---|---|
| Task | B - Count Adjacent Cells |
| User | msd7 |
| Language | Python (PyPy 3.11-v7.3.20) |
| Score | 200 |
| Code Size | 378 Byte |
| Status | AC |
| Exec Time | 68 ms |
| Memory | 92172 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 52 ms | 79616 KiB |
| 00-sample-02.txt | AC | 51 ms | 79620 KiB |
| 00-sample-03.txt | AC | 52 ms | 79732 KiB |
| 01-01.txt | AC | 51 ms | 79620 KiB |
| 01-02.txt | AC | 52 ms | 79616 KiB |
| 01-03.txt | AC | 52 ms | 79508 KiB |
| 01-04.txt | AC | 51 ms | 79500 KiB |
| 01-05.txt | AC | 50 ms | 79612 KiB |
| 01-06.txt | AC | 50 ms | 79276 KiB |
| 01-07.txt | AC | 50 ms | 79604 KiB |
| 01-08.txt | AC | 50 ms | 79508 KiB |
| 01-09.txt | AC | 50 ms | 79496 KiB |
| 01-10.txt | AC | 50 ms | 79888 KiB |
| 01-11.txt | AC | 50 ms | 79848 KiB |
| 01-12.txt | AC | 50 ms | 80012 KiB |
| 01-13.txt | AC | 68 ms | 92172 KiB |
| 01-14.txt | AC | 58 ms | 88836 KiB |
| 01-15.txt | AC | 54 ms | 86148 KiB |
| 01-16.txt | AC | 60 ms | 90812 KiB |
| 01-17.txt | AC | 50 ms | 79904 KiB |
| 01-18.txt | AC | 56 ms | 88156 KiB |
| 01-19.txt | AC | 50 ms | 79448 KiB |