結果
問題 |
No.455 冬の大三角
|
ユーザー |
![]() |
提出日時 | 2017-09-24 09:28:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 725 bytes |
コンパイル時間 | 454 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-14 07:02:26 |
合計ジャッジ時間 | 4,146 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 WA * 5 |
ソースコード
H,W = map(int,input().split()) S = [list(input()) for i in range(H)] d = [ [(1,0),(-1,0)], [(0,1),(1,0)], [(1,-1),(-1,1)], [(-1,-1),(1,1)] ] flag = False for i in range(H): for j in range(W): if S[i][j] == '*': continue flag = False for k in d: a,b = k[0],k[1] ni,nj = i + a[0],j + a[1] ny,nx = i + b[0],j + b[1] cnt = 0 while ni < H and nj < W and ni >= 0 and nj >= 0: if S[ni][nj] == '*': cnt+=1 ni += a[0] nj += a[1] while ny < H and nx < W and ny >= 0 and nx >= 0: if S[ny][nx] == '*': cnt+=1 nx += b[0] ny += b[1] if cnt == 2: flag = True if not flag: S[i][j] = '*' break if not flag: break for i in range(H): print(''.join(S[i]))