結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,064 KB
testcase_01 AC 83 ms
15,108 KB
testcase_02 AC 83 ms
15,156 KB
testcase_03 AC 85 ms
15,132 KB
testcase_04 AC 81 ms
15,068 KB
testcase_05 AC 80 ms
15,308 KB
testcase_06 AC 81 ms
15,340 KB
testcase_07 AC 81 ms
15,344 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 81 ms
15,160 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 194 ms
30,236 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 193 ms
30,244 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 196 ms
30,252 KB
testcase_24 AC 193 ms
30,452 KB
testcase_25 AC 192 ms
30,248 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 195 ms
30,272 KB
testcase_29 AC 207 ms
32,620 KB
testcase_30 AC 80 ms
15,072 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 "YES"
elsif k%2==0
	puts "YES"
else
	puts "NO"
end
0