Submission #4287847


Source Code Expand

Copy
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#A_cnt = N
while True:
    #print(np.where(A>0))
    A_not_zero = A[np.where(A != 0)[0]]
    #print(A_not_zero)
    min_a = min(A_not_zero) # 0より大きい最小値
    A = np.array(list(map(lambda x: (x if x == min_a or x == 0 else x % min_a), A)))
    #print("A", A)
    #print("len", len(set(A)))
    a = sorted(set(A))
    if len(a) == 2:
        result = a[1]
        break
    elif len(a) == 1:
        result = a[0]
        break
print(result)

Submission Info

Submission Time
Task C - Monsters Battle Royale
User showyou41
Language Python3 (3.4.3)
Score 0
Code Size 556 Byte
Status
Exec Time 470 ms
Memory 23132 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 300 0_random_1, 0_random_2, 0_random_3, 0_random_4, 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, 2_corner_7, 2_corner_8, sample_01, sample_02, sample_03
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_random_1 338 ms 18680 KB
0_random_2 470 ms 23108 KB
0_random_3 147 ms 12472 KB
0_random_4 147 ms 12372 KB
1_normal_1 203 ms 14256 KB
1_normal_2 273 ms 19700 KB
1_normal_3 319 ms 23000 KB
1_normal_4 328 ms 23124 KB
1_normal_5 148 ms 12468 KB
1_normal_6 148 ms 12504 KB
2_corner_1 307 ms 22320 KB
2_corner_2 228 ms 23048 KB
2_corner_3 148 ms 12504 KB
2_corner_4 233 ms 23040 KB
2_corner_5 228 ms 23132 KB
2_corner_6 194 ms 14656 KB
2_corner_7 205 ms 14620 KB
2_corner_8 237 ms 15888 KB
sample_01 148 ms 12464 KB
sample_02 147 ms 12472 KB
sample_03 147 ms 12468 KB