Submission #2239869
Source Code Expand
T = input() N = len(T) dp = [[0 for i in range(10)] for j in range(N + 10)] for i in range(N): if T[i] == "2": dp[i + 1][2] = max(dp[i][5] + 1, dp[i + 1][2]) elif T[i] == "5": if dp[i][2] % 2 != 0: dp[i + 1][5] = max(dp[i][2] + 1, dp[i + 1][5]) elif T[i] == "?": dp[i + 1][2] = max(dp[i][5] + 1, dp[i + 1][2]) if dp[i][2] % 2 != 0: dp[i + 1][5] = max(dp[i][2] + 1, dp[i + 1][5]) ans = -1 for j in range(10): for i in range(N + 10): ans = max(dp[i][j], ans) print(ans // 2 * 2)
Submission Info
Submission Time | |
---|---|
Task | B - ニコニコレベル |
User | poyodr |
Language | Python (3.4.3) |
Score | 300 |
Code Size | 579 Byte |
Status | AC |
Exec Time | 562 ms |
Memory | 30644 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, large_01.txt, large_02.txt, large_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 17 ms | 3064 KB |
hand_02.txt | AC | 17 ms | 3064 KB |
hand_03.txt | AC | 17 ms | 3064 KB |
hand_04.txt | AC | 17 ms | 3064 KB |
hand_05.txt | AC | 562 ms | 30644 KB |
large_01.txt | AC | 516 ms | 25052 KB |
large_02.txt | AC | 520 ms | 27036 KB |
large_03.txt | AC | 502 ms | 27384 KB |
random_01.txt | AC | 492 ms | 24308 KB |
random_02.txt | AC | 539 ms | 24308 KB |
random_03.txt | AC | 533 ms | 24308 KB |
random_04.txt | AC | 509 ms | 24308 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 |
sample_05.txt | AC | 17 ms | 3064 KB |