Submission #3025141


Source Code Expand

N = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)

def lcm(a, b):
  return a*b/gcd(a,b)

alcm = a[0]
for i in a[1:]:
  alcm = lcm(alcm, i) 

res = 0

for i in range(N):
  res += (alcm-1) % a[i]

print(int(res))

Submission Info

Submission Time
Task C - Modulo Summation
User aki85
Language PyPy3 (2.4.0)
Score 0
Code Size 296 Byte
Status RE
Exec Time 322 ms
Memory 51568 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 8
RE × 10
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All 1_small_rand_0, 1_small_rand_1, 1_small_rand_2, 2_rand_0, 2_rand_1, 2_rand_2, 3_max_0, 3_max_1, 3_max_2, 4_prime_0, 4_prime_1, 4_prime_2, 5_hand_0, 5_hand_1, 5_hand_2, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
1_small_rand_0 AC 164 ms 38256 KB
1_small_rand_1 AC 165 ms 38256 KB
1_small_rand_2 AC 164 ms 38256 KB
2_rand_0 RE 322 ms 51568 KB
2_rand_1 RE 296 ms 49776 KB
2_rand_2 RE 290 ms 49392 KB
3_max_0 RE 291 ms 49648 KB
3_max_1 RE 291 ms 49648 KB
3_max_2 RE 294 ms 49776 KB
4_prime_0 RE 295 ms 49648 KB
4_prime_1 RE 301 ms 49648 KB
4_prime_2 RE 301 ms 49648 KB
5_hand_0 RE 293 ms 49648 KB
5_hand_1 AC 176 ms 39664 KB
5_hand_2 AC 175 ms 39664 KB
sample_01 AC 165 ms 38256 KB
sample_02 AC 163 ms 38256 KB
sample_03 AC 165 ms 38256 KB