結果

問題 No.482 あなたの名は
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-27 19:38:43
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 280 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 11,496 KB
実行使用メモリ 32,712 KB
最終ジャッジ日時 2023-09-07 19:04:52
合計ジャッジ時間 6,210 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,200 KB
testcase_01 AC 80 ms
15,200 KB
testcase_02 AC 77 ms
15,048 KB
testcase_03 AC 81 ms
15,052 KB
testcase_04 AC 79 ms
15,164 KB
testcase_05 AC 77 ms
15,120 KB
testcase_06 AC 79 ms
15,156 KB
testcase_07 AC 78 ms
15,160 KB
testcase_08 WA -
testcase_09 AC 77 ms
15,048 KB
testcase_10 AC 78 ms
15,152 KB
testcase_11 AC 77 ms
15,276 KB
testcase_12 WA -
testcase_13 AC 77 ms
15,272 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 194 ms
30,172 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 184 ms
30,248 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 190 ms
30,228 KB
testcase_24 AC 188 ms
30,200 KB
testcase_25 AC 186 ms
30,072 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 190 ms
30,176 KB
testcase_29 AC 202 ms
32,712 KB
testcase_30 AC 78 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,k=gets.split.map{|e| e.to_i}
x=gets.split.map{|e| e.to_i-1}
hs={}
i=0
while x.empty? == false
	e=x.shift
	#p [e,i,k,hs]
	if e==i
		i+=1
		next
	end
	
	if hs.key?(i)!=false
		i+=1
		next
	end
	hs[e]=0
	k-=1
	i+=1
end
if k<0
	puts "NO"
elsif k%2==0
	puts "YES"
else
	puts "NO"
end
0