結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-27 19:37:40 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 281 bytes |
| 記録 | |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 31,488 KB |
| 最終ジャッジ日時 | 2024-06-25 12:51:12 |
| 合計ジャッジ時間 | 6,278 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 14 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
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
horiesiniti