Submission #2380646
Source Code Expand
row, col = 30, 30 board = [[-1 for i in range(30)] for i in range(30)] dx = (1, 0, 0, -1) dy = (0, 1, -1, 0) def _input(): for i in range(30): l = map(int, input().split()) for j, v in enumerate(l): board[i][j] = v def solve_fool(): global board for i in range(row): for j in range(col): while(board[i][j] > 0): board[i][j] -= 1 print(i+1, j+1) def out_map(x, y): return not (x > -1 and y > -1 and x < row and y < col) def is_top(x, y): for d in range(len(dx)): nx = x + dx[d] ny = y + dy[d] if (out_map(nx, ny)): continue if board[x][y] <= 0 or board[nx][ny] > board[x][y]: return False return True def choose_top(): for i in range(row): for j in range(col): if(is_top(i, j)): return i, j return None def solve_wisdom(): global board p = choose_top() while p != None: while True: x, y = p[0], p[1] print(x+1, y+1) board[x][y] -= 1 next_point = None for d in range(len(dx)): nx = x + dx[d] ny = y + dy[d] if out_map(nx, ny): continue if (board[x][y] == board[nx][ny] and board[nx][ny] > 0): next_point = nx, ny break if next_point != None: p = next_point continue break p = choose_top() def solve(): _input() # solve_fool() solve_wisdom() if __name__ == "__main__": solve()
Submission Info
Submission Time | |
---|---|
Task | A - 高橋君の山崩しゲーム |
User | a_key_bako |
Language | Python (3.4.3) |
Score | 800640 |
Code Size | 1753 Byte |
Status | AC |
Exec Time | 8122 ms |
Memory | 4040 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 | 79973 / 100000 | 79417 / 100000 | 80928 / 100000 | 78928 / 100000 | 80581 / 100000 | 80021 / 100000 | 80558 / 100000 | 80290 / 100000 | 80166 / 100000 | 79778 / 100000 | ||||||||||||||||||||
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 | 7455 ms | 4040 KB |
subtask_01_02.txt | AC | 8122 ms | 4032 KB |
subtask_01_03.txt | AC | 7119 ms | 3996 KB |
subtask_01_04.txt | AC | 7788 ms | 4012 KB |
subtask_01_05.txt | AC | 7260 ms | 4016 KB |
subtask_01_06.txt | AC | 7625 ms | 4024 KB |
subtask_01_07.txt | AC | 7317 ms | 3984 KB |
subtask_01_08.txt | AC | 8003 ms | 4028 KB |
subtask_01_09.txt | AC | 7186 ms | 3988 KB |
subtask_01_10.txt | AC | 7518 ms | 4012 KB |