結果

問題 No.100 直列あみだくじ
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-18 00:26:27
言語 Ruby
(3.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 172 bytes
コンパイル時間 35 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-03 04:32:21
合計ジャッジ時間 5,667 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
12,160 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 89 ms
12,288 KB
testcase_04 WA -
testcase_05 AC 89 ms
12,160 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 93 ms
12,288 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 89 ms
12,032 KB
testcase_14 AC 89 ms
12,160 KB
testcase_15 AC 89 ms
12,160 KB
testcase_16 AC 89 ms
12,032 KB
testcase_17 AC 92 ms
12,160 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 90 ms
12,160 KB
testcase_26 WA -
testcase_27 AC 88 ms
12,288 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 90 ms
12,160 KB
testcase_34 AC 92 ms
12,032 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 89 ms
12,160 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 89 ms
12,160 KB
testcase_43 AC 88 ms
12,160 KB
testcase_44 AC 89 ms
12,288 KB
testcase_45 WA -
testcase_46 AC 89 ms
12,160 KB
testcase_47 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
f=gets.split.map &:to_i
puts (1..n).map{|u|l=1;m=v=u;(l+=1;m=[m,v].min)while(v=f[v-1])!=u;[l,m]}.uniq.group_by{|x|x[0]}.any?{|k,v|(k[0]+1)*v.size%2>0}?:No: :Yes
0