結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
19,872 KB
testcase_01 AC 170 ms
15,448 KB
testcase_02 AC 167 ms
15,520 KB
testcase_03 AC 163 ms
15,520 KB
testcase_04 AC 163 ms
15,392 KB
testcase_05 AC 161 ms
15,484 KB
testcase_06 AC 166 ms
15,468 KB
testcase_07 AC 165 ms
15,496 KB
testcase_08 AC 165 ms
15,480 KB
testcase_09 AC 166 ms
15,424 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 334 ms
25,712 KB
testcase_16 AC 349 ms
26,196 KB
testcase_17 AC 355 ms
26,132 KB
testcase_18 AC 347 ms
25,876 KB
testcase_19 AC 349 ms
26,000 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 171 ms
15,400 KB
testcase_31 AC 293 ms
23,616 KB
testcase_32 AC 295 ms
23,648 KB
testcase_33 AC 327 ms
26,556 KB
testcase_34 AC 172 ms
15,480 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