Submission #10074835
Source Code Expand
#!/usr/bin/env python3 import sys def solve(A: int, B: int, N: int, X: str): for x in X: if x == 'S': if 0 < A: A-=1 elif x == 'C': if 0 < B: B-=1 else: if A > B: A-=1 elif B > A: B-=1 elif 0 < A and 0 < B and A==B: A-=1 elif A==0 and B==0: continue return A, B # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() A = int(next(tokens)) # type: int B = int(next(tokens)) # type: int N = int(next(tokens)) # type: int X = next(tokens) # type: str a, b = solve(A, B, N, X) print("{}\n{}".format(a, b)) if __name__ == '__main__': main()
Submission Info
Submission Time | |
---|---|
Task | B - 洋菓子店 |
User | ch1aki |
Language | Python (3.4.3) |
Score | 200 |
Code Size | 1049 Byte |
Status | AC |
Exec Time | 28 ms |
Memory | 3188 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | 27 ms | 3188 KB |
02.txt | AC | 23 ms | 3188 KB |
03.txt | AC | 24 ms | 3188 KB |
04.txt | AC | 25 ms | 3188 KB |
05.txt | AC | 20 ms | 3064 KB |
06.txt | AC | 28 ms | 3188 KB |
07.txt | AC | 18 ms | 3064 KB |
08.txt | AC | 17 ms | 3064 KB |
sample-01.txt | AC | 17 ms | 3064 KB |
sample-02.txt | AC | 17 ms | 3064 KB |
sample-03.txt | AC | 17 ms | 3064 KB |
sample-04.txt | AC | 17 ms | 3064 KB |