Submission #10076915


Source Code Expand

a, b, n = gets.chomp.split(" ").map(&:to_i)

X = gets.chomp.split("")

X.each { |x|
  if x == "S" then
    a -= 1 if a > 0
  elsif x == "C" then
    b -= 1 if b > 0
  elsif x == "E" then
    if a == 0 && b == 0 then
    elsif a > b && b >= 0 then
      a -= 1
    elsif b > a && a >= 0 then
      b -= 1
    elsif a == b && a > 0 then
      a -= 1
    end
  end
}

puts a
puts b

Submission Info

Submission Time
Task B - 洋菓子店
User rotelstift
Language Ruby (2.3.3)
Score 200
Code Size 400 Byte
Status AC
Exec Time 72 ms
Memory 9340 KB

Compile Error

./Main.rb:1: warning: assigned but unused variable - n

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 12
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt
Case Name Status Exec Time Memory
01.txt AC 61 ms 8828 KB
02.txt AC 42 ms 5628 KB
03.txt AC 49 ms 6012 KB
04.txt AC 50 ms 6012 KB
05.txt AC 23 ms 3708 KB
06.txt AC 72 ms 9340 KB
07.txt AC 14 ms 2556 KB
08.txt AC 7 ms 1788 KB
sample-01.txt AC 7 ms 1788 KB
sample-02.txt AC 7 ms 1788 KB
sample-03.txt AC 7 ms 1788 KB
sample-04.txt AC 7 ms 1788 KB