Submission #41449351


Source Code Expand

def update(b, i, j, level):
	if i < 0:
		return
	if len(b) <= i:
		return
	if j < 0:
		return
	if len(b[0]) <= j:
		return
	if '0' < b[i][j] and b[i][j] <= '9':
		level0 = int(b[i][j])
		level = max(level, level0)
	b[i] = b[i][:j] + chr(ord('0') + level) + b[i][j+1:]


n,m = map(int, input().split())
a = []
b = []
for i in range(n):
	a.append(input())
	b.append(a[-1][:])

for t in range(11):
	for i in range(n):
		for j in range(m):
			if '0' <= a[i][j] and a[i][j] <= '9':
				b[i] = b[i][:j] + '.' + b[i][j+1:]
	for i in range(n):
		for j in range(m):
			if '0' <= a[i][j] and a[i][j] <= '9':
				if '0' < a[i][j]:
					update(b, i-1, j, int(a[i][j])-1)
					update(b, i+1, j, int(a[i][j])-1)
					update(b, i, j-1, int(a[i][j])-1)
					update(b, i, j+1, int(a[i][j])-1)
				b[i] = b[i][:j] + '.' + b[i][j+1:]
				a[i] = a[i][:j] + '.' + a[i][j+1:]
	a,b=b,a
for i in range(n):
	print(a[i])

Submission Info

Submission Time
Task B - Bombs
User T1024
Language PyPy3 (7.3.0)
Score 0
Code Size 935 Byte
Status WA
Exec Time 101 ms
Memory 74516 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 4
AC × 21
WA × 1
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_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, 01_random_16.txt, 01_random_17.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 62 ms 62228 KiB
00_sample_01.txt AC 48 ms 61732 KiB
00_sample_02.txt AC 43 ms 61876 KiB
00_sample_03.txt AC 49 ms 62216 KiB
01_random_00.txt AC 54 ms 64792 KiB
01_random_01.txt AC 53 ms 65112 KiB
01_random_02.txt AC 52 ms 64916 KiB
01_random_03.txt AC 58 ms 69052 KiB
01_random_04.txt AC 57 ms 66432 KiB
01_random_05.txt AC 75 ms 73928 KiB
01_random_06.txt AC 75 ms 74516 KiB
01_random_07.txt WA 75 ms 74008 KiB
01_random_08.txt AC 56 ms 66236 KiB
01_random_09.txt AC 54 ms 66916 KiB
01_random_10.txt AC 57 ms 67432 KiB
01_random_11.txt AC 64 ms 71284 KiB
01_random_12.txt AC 74 ms 73692 KiB
01_random_13.txt AC 76 ms 73472 KiB
01_random_14.txt AC 64 ms 71008 KiB
01_random_15.txt AC 75 ms 74068 KiB
01_random_16.txt AC 101 ms 74388 KiB
01_random_17.txt AC 47 ms 61932 KiB