Submission #10074603


Source Code Expand

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

a = A
b = B

X.chars.each do |c|
 case c
 when "S"
   a -= 1 if a > 0
 when "C"
   b -= 1 if b > 0
 when "E"
   break if a == 0 && b == 0

   if a >= b
     a -= 1
   else
     b -= 1
   end
 end
end

puts [a, b]

Submission Info

Submission Time
Task B - 洋菓子店
User june29
Language Ruby (2.3.3)
Score 200
Code Size 286 Byte
Status AC
Exec Time 35 ms
Memory 6396 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 31 ms 5500 KB
02.txt AC 20 ms 3836 KB
03.txt AC 27 ms 4732 KB
04.txt AC 26 ms 4732 KB
05.txt AC 14 ms 2812 KB
06.txt AC 35 ms 6396 KB
07.txt AC 9 ms 2044 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