結果

問題 No.482 あなたの名は
ユーザー mmmpppmmmppp
提出日時 2017-02-24 11:13:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 173 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 11,464 KB
実行使用メモリ 55,224 KB
最終ジャッジ日時 2023-08-30 23:03:21
合計ジャッジ時間 7,067 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,124 KB
testcase_01 AC 77 ms
15,040 KB
testcase_02 AC 75 ms
15,040 KB
testcase_03 AC 78 ms
15,240 KB
testcase_04 AC 78 ms
15,300 KB
testcase_05 AC 79 ms
15,356 KB
testcase_06 AC 79 ms
15,132 KB
testcase_07 AC 79 ms
15,184 KB
testcase_08 AC 80 ms
15,188 KB
testcase_09 AC 80 ms
15,044 KB
testcase_10 AC 78 ms
15,304 KB
testcase_11 AC 78 ms
15,308 KB
testcase_12 AC 78 ms
15,256 KB
testcase_13 AC 79 ms
15,380 KB
testcase_14 AC 80 ms
15,116 KB
testcase_15 AC 280 ms
55,012 KB
testcase_16 AC 278 ms
55,224 KB
testcase_17 AC 281 ms
55,044 KB
testcase_18 AC 278 ms
55,112 KB
testcase_19 AC 277 ms
55,016 KB
testcase_20 AC 281 ms
54,932 KB
testcase_21 AC 277 ms
55,164 KB
testcase_22 AC 273 ms
55,028 KB
testcase_23 AC 276 ms
55,004 KB
testcase_24 AC 284 ms
55,008 KB
testcase_25 AC 277 ms
55,164 KB
testcase_26 AC 279 ms
55,088 KB
testcase_27 AC 281 ms
54,932 KB
testcase_28 AC 277 ms
55,096 KB
testcase_29 AC 287 ms
55,204 KB
testcase_30 AC 77 ms
15,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

eval"n,k,*d=#{$<.flat_map(&:split)*?,}
x,c=[],0
n.times{|i|x[d[i]]=i}
n.times{|i|(a=d[i])==(m=i+1)||(c+=1;d[x[m]],d[i],x[a],x[m]=a,m,x[m],i)}
puts c<=k&&1&(k^c)<1?:YES:'NO'"
0