結果

問題 No.482 あなたの名は
ユーザー cielciel
提出日時 2017-02-19 21:36:24
言語 Ruby
(3.3.0)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 183 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 29,548 KB
最終ジャッジ日時 2023-08-28 19:19:10
合計ジャッジ時間 6,215 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,304 KB
testcase_01 AC 82 ms
15,288 KB
testcase_02 AC 83 ms
15,284 KB
testcase_03 AC 84 ms
15,284 KB
testcase_04 AC 83 ms
15,336 KB
testcase_05 AC 82 ms
15,132 KB
testcase_06 AC 82 ms
15,136 KB
testcase_07 AC 83 ms
15,268 KB
testcase_08 AC 80 ms
15,288 KB
testcase_09 AC 80 ms
15,244 KB
testcase_10 AC 79 ms
15,320 KB
testcase_11 AC 80 ms
15,272 KB
testcase_12 AC 79 ms
15,176 KB
testcase_13 AC 80 ms
15,308 KB
testcase_14 AC 79 ms
15,132 KB
testcase_15 AC 201 ms
29,372 KB
testcase_16 AC 200 ms
29,472 KB
testcase_17 AC 201 ms
29,392 KB
testcase_18 AC 200 ms
29,464 KB
testcase_19 AC 200 ms
29,472 KB
testcase_20 AC 207 ms
29,388 KB
testcase_21 AC 201 ms
29,372 KB
testcase_22 AC 200 ms
29,548 KB
testcase_23 AC 199 ms
29,368 KB
testcase_24 AC 201 ms
29,416 KB
testcase_25 AC 208 ms
29,364 KB
testcase_26 AC 200 ms
29,512 KB
testcase_27 AC 200 ms
29,372 KB
testcase_28 AC 199 ms
29,348 KB
testcase_29 AC 198 ms
29,420 KB
testcase_30 AC 79 ms
15,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
n,k,*d=`dd`.split.map(&:to_i)
q=0
n.times{|i|
	if d[i]>=0
		d[i],c=-1,d[i]-1
		q+=0
		while c!=i
			d[c],c=-1,d[c]-1
			q+=1
		end
	end
}
puts q<=k&&q%2==k%2?:YES: :NO
0