結果

問題 No.1015 おつりは要らないです
ユーザー zazaboonzazaboon
提出日時 2020-04-27 22:26:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 1,306 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 26,792 KB
最終ジャッジ日時 2023-08-14 14:20:51
合計ジャッジ時間 12,057 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
22,496 KB
testcase_01 AC 79 ms
15,488 KB
testcase_02 AC 80 ms
15,376 KB
testcase_03 AC 80 ms
15,384 KB
testcase_04 AC 79 ms
15,316 KB
testcase_05 AC 78 ms
15,420 KB
testcase_06 AC 82 ms
15,304 KB
testcase_07 AC 80 ms
15,336 KB
testcase_08 AC 78 ms
15,368 KB
testcase_09 AC 78 ms
15,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 240 ms
25,604 KB
testcase_16 AC 264 ms
25,996 KB
testcase_17 AC 257 ms
26,332 KB
testcase_18 AC 268 ms
26,016 KB
testcase_19 AC 262 ms
25,812 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 82 ms
15,456 KB
testcase_31 AC 200 ms
23,356 KB
testcase_32 AC 199 ms
23,384 KB
testcase_33 AC 244 ms
26,792 KB
testcase_34 AC 83 ms
15,340 KB
testcase_35 WA -
testcase_36 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: assigned but unused variable - a
Main.rb:6: warning: assigned but unused variable - a
Main.rb:18: warning: assigned but unused variable - a
Main.rb:27: warning: assigned but unused variable - n
Main.rb:76: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end
n,x,y,z = inp
a = inp
a.map!{|u|u+1}
a.sort_by!{|a|a%10000*-1}
m_c = a.sum{|u|u/10000}
a.map!{|u|u%10000}
if(z > m_c)
  (z-m_c).times do
    a.shift
  end
else
  a[0] += 10000 * (m_c - z)
end

if(a.size <= 0)
  puts "Yes"
  exit
end
a.sort_by!{|a|a%5000*-1}
m_c = a.sum{|u|u/5000}
a.map!{|u|u%5000}
if(y > m_c)
  (y-m_c).times do
    a.shift
  end
else
  a[0] += 5000 * (m_c - y)
end

if(a.size <= 0)
  puts "Yes"
  exit
end
a.sort_by!{|a|a%5000*-1}
m_c = a.sum{|u|u/1000}
a.map!{|u|u%1000}
if(x > m_c)
  (x-m_c).times do
    a.shift
  end
else
  a[0] += 1000 * (m_c - x)
end

if(a.size <= 0)
  puts "Yes"
  exit
end
puts "No"
i = 0
0