Submission #4283800


Source Code Expand

Copy
N, m = map(int, raw_input().split())
a = map(int, raw_input().split())
C = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]

C = [C[A] for A in a]

dp = [-float('inf')] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
    for j in range(len(C)):
        if C[j] <= i:
            dp[i] = max(dp[i], dp[i - C[j]] * 10 + a[j])

print dp[N]

Submission Info

Submission Time
Task D - Match Matching
User arock
Language PyPy2 (5.6.0)
Score 400
Code Size 332 Byte
Status AC
Exec Time 103 ms
Memory 43292 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 29
AC × 3
Set Name Test Cases
All 0_random_1, 0_random_2, 0_random_3, 0_random_4, 0_random_5, 0_random_6, 0_random_7, 0_random_8, 1_normal_1, 1_normal_2, 1_normal_3, 1_normal_4, 1_normal_5, 1_normal_6, 2_corner_1, 2_corner_2, 2_corner_3, 2_corner_4, 2_corner_5, 2_corner_6, 3_hand_1, 3_hand_2, 3_hand_3, 3_hand_4, 3_hand_5, 3_hand_6, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_random_1 AC 36 ms 27500 KB
0_random_2 AC 33 ms 26732 KB
0_random_3 AC 54 ms 33132 KB
0_random_4 AC 79 ms 43164 KB
0_random_5 AC 88 ms 39836 KB
0_random_6 AC 69 ms 37532 KB
0_random_7 AC 41 ms 30444 KB
0_random_8 AC 38 ms 28652 KB
1_normal_1 AC 49 ms 32620 KB
1_normal_2 AC 66 ms 36636 KB
1_normal_3 AC 57 ms 33564 KB
1_normal_4 AC 72 ms 38940 KB
1_normal_5 AC 61 ms 38940 KB
1_normal_6 AC 59 ms 33564 KB
2_corner_1 AC 48 ms 32748 KB
2_corner_2 AC 41 ms 30188 KB
2_corner_3 AC 60 ms 33948 KB
2_corner_4 AC 50 ms 32412 KB
2_corner_5 AC 42 ms 30188 KB
2_corner_6 AC 53 ms 32540 KB
3_hand_1 AC 58 ms 35740 KB
3_hand_2 AC 33 ms 27244 KB
3_hand_3 AC 33 ms 26604 KB
3_hand_4 AC 33 ms 26860 KB
3_hand_5 AC 33 ms 28012 KB
3_hand_6 AC 103 ms 43292 KB
sample_01 AC 33 ms 27884 KB
sample_02 AC 34 ms 28652 KB
sample_03 AC 33 ms 27244 KB