結果

問題 No.13 囲みたい!
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-03-01 21:15:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 96 ms / 5,000 ms
コード長 243 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 15,748 KB
最終ジャッジ日時 2023-08-26 23:13:39
合計ジャッジ時間 2,467 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,168 KB
testcase_01 AC 80 ms
15,224 KB
testcase_02 AC 84 ms
15,248 KB
testcase_03 AC 94 ms
15,692 KB
testcase_04 AC 85 ms
15,440 KB
testcase_05 AC 96 ms
15,492 KB
testcase_06 AC 91 ms
15,572 KB
testcase_07 AC 92 ms
15,588 KB
testcase_08 AC 91 ms
15,496 KB
testcase_09 AC 90 ms
15,748 KB
testcase_10 AC 84 ms
15,080 KB
testcase_11 AC 87 ms
15,440 KB
testcase_12 AC 83 ms
15,148 KB
testcase_13 AC 85 ms
15,476 KB
testcase_14 AC 85 ms
15,312 KB
testcase_15 AC 81 ms
15,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def r u;u==$p[u]?u:$p[u]=r($p[u]);end
n,m=gets.split.map &:to_i
a=(1..m).map{gets.split.map &:to_i}+[[]]
i=0...m*n
$p=i.to_a
print i.any?{|z|x=z/n;y=z%n
[[x+1,y],[x,y+1]].any?{|e,f|a[x][y]==a[e][f]&&($p[u=r(z)]=r e*n+f)==u}}?'':'im','possible'
0