Submission #10075055


Source Code Expand

# https://atcoder.jp/contests/bitflyer2018-qual/tasks/bitflyer2018_qual_b



A, B, N = gets.split.map(&:to_i)
X = gets.chomp

short_cake = A
cheese_cake = B

X.chars do |char|
  case char
  when 'S'
    short_cake -= 1 if short_cake > 0
  when 'C'
    cheese_cake -= 1 if cheese_cake > 0
  when 'E'
    if short_cake >= cheese_cake
      short_cake -= 1 if short_cake > 0
    else
      cheese_cake -= 1 if cheese_cake > 0
    end
  end
  break if short_cake == 0 && cheese_cake == 0
end

puts short_cake
puts cheese_cake

Submission Info

Submission Time
Task B - 洋菓子店
User tanaken0515
Language Ruby (2.3.3)
Score 200
Code Size 522 Byte
Status AC
Exec Time 28 ms
Memory 1916 KB

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 24 ms 1916 KB
02.txt AC 18 ms 1916 KB
03.txt AC 20 ms 1916 KB
04.txt AC 20 ms 1916 KB
05.txt AC 12 ms 1788 KB
06.txt AC 28 ms 1916 KB
07.txt AC 9 ms 1916 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