Submission #3426686
Source Code Expand
h,w = map(int, input().split()) s = [list(input()) for i in range(h)] dp = [[0 for i in range(w)] for j in range(h)] dp_2 = [[float("inf") for i in range(w)] for j in range(h)] dp[0][0] = 1 dp_2[0][0] = 0 for y in range(1,h): if s[y][0] == "#": break dp[y][0] = 2 if y%2 == 0 else 1 dp_2[y][0] = dp_2[y-1][0]+1 for x in range(1,w): if s[0][x] == "#": break dp[0][x] = 2 if x%2 == 0 else 1 dp_2[0][x] = dp_2[0][x-1]+1 for y in range(1,h): for x in range(1,w): if s[y][x] == ".": dp[y][x] = max(dp[y-1][x], dp[y][x-1]) dp_2[y][x] = min(dp_2[y-1][x]+1, dp_2[y][x-1]+1,dp_2[y-1][x-1]+1) ma_y = 0 ma_x = 0 for y in range(h): for x in range(w): if dp_2[ma_y][ma_x] <= dp_2[y][x] and dp_2[y][x] != float("inf"): ma_y = y ma_x = x lis = [0, "First", "Second"] print(lis[dp[ma_y][ma_x]])
Submission Info
Submission Time | |
---|---|
Task | B - マス目と駒 |
User | vjudge1 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 891 Byte |
Status | WA |
Exec Time | 34 ms |
Memory | 3444 KB |
Judge Result
Set Name | Sample | Dataset1 | Dataset2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 30 | 0 / 70 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
Dataset1 | sample-01.txt, sample-02.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 |
Dataset2 | sample-01.txt, sample-02.txt, 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, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 17 ms | 3188 KB |
01-02.txt | WA | 17 ms | 3064 KB |
01-03.txt | AC | 17 ms | 3188 KB |
01-04.txt | AC | 17 ms | 3188 KB |
01-05.txt | WA | 17 ms | 3188 KB |
01-06.txt | WA | 17 ms | 3064 KB |
01-07.txt | WA | 17 ms | 3064 KB |
01-08.txt | AC | 17 ms | 3188 KB |
01-09.txt | AC | 17 ms | 3188 KB |
01-10.txt | WA | 17 ms | 3188 KB |
01-11.txt | AC | 17 ms | 3188 KB |
01-12.txt | AC | 17 ms | 3064 KB |
01-13.txt | WA | 17 ms | 3188 KB |
01-14.txt | WA | 17 ms | 3188 KB |
01-15.txt | WA | 17 ms | 3064 KB |
02-01.txt | WA | 34 ms | 3444 KB |
02-02.txt | WA | 17 ms | 3188 KB |
02-03.txt | WA | 21 ms | 3188 KB |
02-04.txt | WA | 17 ms | 3064 KB |
02-05.txt | WA | 17 ms | 3188 KB |
02-06.txt | AC | 33 ms | 3444 KB |
02-07.txt | WA | 34 ms | 3444 KB |
02-08.txt | WA | 33 ms | 3444 KB |
02-09.txt | WA | 34 ms | 3444 KB |
02-10.txt | AC | 33 ms | 3444 KB |
02-11.txt | WA | 34 ms | 3444 KB |
02-12.txt | WA | 34 ms | 3444 KB |
02-13.txt | WA | 33 ms | 3444 KB |
02-14.txt | AC | 30 ms | 3444 KB |
02-15.txt | WA | 26 ms | 3444 KB |
sample-01.txt | AC | 17 ms | 3064 KB |
sample-02.txt | AC | 17 ms | 3188 KB |
sample-03.txt | AC | 18 ms | 3188 KB |