Submission #1847507


Source Code Expand

s = list(str(input()))

g = 0
p = 0
res = 0
for i in range(len(s)):
	if s[i] == 'p':
		if p + 1 <= g:
			p += 1
		else:
			g += 1
			res -= 1
	else: # if s[i] == 'g':
		if p + 1 <= g:
			p += 1
			res += 1
		else:
			g+=1

print(res)

Submission Info

Submission Time
Task D - AtCoDeer and Rock-Paper
User ty70
Language Python (3.4.3)
Score 300
Code Size 252 Byte
Status AC
Exec Time 49 ms
Memory 3956 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 25
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt
Case Name Status Exec Time Memory
0_000.txt AC 18 ms 3064 KB
0_001.txt AC 17 ms 3060 KB
1_002.txt AC 44 ms 3956 KB
1_003.txt AC 33 ms 3572 KB
1_004.txt AC 43 ms 3956 KB
1_005.txt AC 31 ms 3572 KB
1_006.txt AC 43 ms 3956 KB
1_007.txt AC 19 ms 3060 KB
1_008.txt AC 45 ms 3956 KB
1_009.txt AC 44 ms 3956 KB
1_010.txt AC 46 ms 3956 KB
1_011.txt AC 34 ms 3572 KB
1_012.txt AC 45 ms 3956 KB
1_013.txt AC 20 ms 3060 KB
1_014.txt AC 47 ms 3956 KB
1_015.txt AC 41 ms 3828 KB
1_016.txt AC 48 ms 3956 KB
1_017.txt AC 47 ms 3956 KB
1_018.txt AC 49 ms 3956 KB
1_019.txt AC 18 ms 3060 KB
1_020.txt AC 48 ms 3956 KB
1_021.txt AC 41 ms 3828 KB
1_022.txt AC 47 ms 3956 KB
1_023.txt AC 43 ms 3956 KB
1_024.txt AC 45 ms 3956 KB