Submission #1166099
Source Code Expand
temp=input().split() H=int(temp[0]) W=int(temp[1]) K=int(temp[2]) s=[[int(i) for i in input()]for i in range(H)] ans=[] used=[[False for i in range(W)] for j in range(H)] exist9=[[False for i in range(W)] for j in range(H)] for i in range(H): for j in range(W): if s[i][j]==9: exist9[i][j]=True for i1 in range(H): for j1 in range(W): if exist9[i1][j1]==True and used[i1][j1]==False: used[i1][j1]=True place=[[i1,j1]] for temp0 in range(K-1): tempMax=-1 tempMaxPlace=[-1,-1] for tempPlace in place: if 0<tempPlace[0]: if s[tempPlace[0]-1][tempPlace[1]]>tempMax and used[tempPlace[0]-1][tempPlace[1]]==False: tempMax=s[tempPlace[0]-1][tempPlace[1]] tempMaxPlace=[tempPlace[0]-1,tempPlace[1]] if tempMax>6: break if tempPlace[0]<H-1: if s[tempPlace[0]+1][tempPlace[1]]>tempMax and used[tempPlace[0]+1][tempPlace[1]]==False: tempMax=s[tempPlace[0]+1][tempPlace[1]] tempMaxPlace=[tempPlace[0]+1,tempPlace[1]] if tempMax>6: break if 0<tempPlace[1]: if s[tempPlace[0]][tempPlace[1]-1]>tempMax and used[tempPlace[0]][tempPlace[1]-1]==False: tempMax=s[tempPlace[0]][tempPlace[1]-1] tempMaxPlace=[tempPlace[0],tempPlace[1]-1] if tempMax>6: break if tempPlace[1]<W-1: if s[tempPlace[0]][tempPlace[1]+1]>tempMax and used[tempPlace[0]][tempPlace[1]+1]==False: tempMax=s[tempPlace[0]][tempPlace[1]+1] tempMaxPlace=[tempPlace[0],tempPlace[1]+1] if tempMax>6: break if tempMax==-1: break place.append(tempMaxPlace) used[tempMaxPlace[0]][tempMaxPlace[1]]=True else: ans.append(place) temp=len(ans) print(temp) for i in range(temp): for j in range(K): sent=str(ans[i][j][0]+1) sent+=" " sent+=str(ans[i][j][1]+1) print(sent)
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Pieces |
User | toma25 |
Language | Python (3.4.3) |
Score | 729672 |
Code Size | 1909 Byte |
Status | AC |
Exec Time | 28 ms |
Memory | 3428 KB |
Judge Result
Set Name | test_01 | test_02 | test_03 | test_04 | test_05 | test_06 | test_07 | test_08 | test_09 | test_10 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 72669 / 1343058 | 67674 / 1343058 | 71860 / 1343058 | 69527 / 1343058 | 80886 / 1343058 | 71969 / 1343058 | 78621 / 1343058 | 66108 / 1343058 | 74669 / 1343058 | 75689 / 1343058 | ||||||||||||||||||||
Status |
|
|
|
|
|
|
|
|
|
|
Set Name | Test Cases |
---|---|
test_01 | subtask_01_01.txt |
test_02 | subtask_01_02.txt |
test_03 | subtask_01_03.txt |
test_04 | subtask_01_04.txt |
test_05 | subtask_01_05.txt |
test_06 | subtask_01_06.txt |
test_07 | subtask_01_07.txt |
test_08 | subtask_01_08.txt |
test_09 | subtask_01_09.txt |
test_10 | subtask_01_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask_01_01.txt | AC | 28 ms | 3428 KB |
subtask_01_02.txt | AC | 28 ms | 3428 KB |
subtask_01_03.txt | AC | 28 ms | 3428 KB |
subtask_01_04.txt | AC | 27 ms | 3428 KB |
subtask_01_05.txt | AC | 26 ms | 3428 KB |
subtask_01_06.txt | AC | 28 ms | 3428 KB |
subtask_01_07.txt | AC | 28 ms | 3428 KB |
subtask_01_08.txt | AC | 27 ms | 3428 KB |
subtask_01_09.txt | AC | 28 ms | 3428 KB |
subtask_01_10.txt | AC | 27 ms | 3428 KB |