結果
| 問題 | No.13 囲みたい! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-02 13:02:37 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 644 bytes |
| 記録 | |
| コンパイル時間 | 285 ms |
| コンパイル使用メモリ | 77,760 KB |
| 最終ジャッジ日時 | 2025-12-04 00:26:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 RE * 7 |
ソースコード
#yuki_13 def dfs(y,x,py,px,n): global suc if suc: return done[y][x]=True for i in xrange(4): ny=y+dy[i] nx=x+dx[i] if not (0<=ny and ny<H and 0<=nx and nx<W): continue if ny==py and nx==px: continue if a[ny][nx]!=n: continue if done[ny][nx]: sucue return dfs(ny,nx,y,x,n) W,H=map(int,raw_input().split()) a=[] for i in xrange(H): temp=map(int,raw_input().split()) a.append(temp) done=[[0 for i in xrange(W)] for j in xrange(H)] dx=[-1,0,1,0] dy=[0,1,0,-1] suc=False for i in xrange(H): for j in xrange(W): if suc: break if done[i][j]: continue dfs(i,j,i,j,a[i][j]) print 'possible' if suc else 'impossible'