結果
問題 | No.1036 Make One With GCD 2 |
ユーザー | nehan_der_thal |
提出日時 | 2020-04-26 17:28:50 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 82,308 KB |
実行使用メモリ | 211,500 KB |
最終ジャッジ日時 | 2024-04-28 19:19:16 |
合計ジャッジ時間 | 21,521 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 299 ms
173,656 KB |
testcase_02 | RE | - |
testcase_03 | AC | 90 ms
99,908 KB |
testcase_04 | AC | 114 ms
120,824 KB |
testcase_05 | AC | 39 ms
51,880 KB |
testcase_06 | AC | 39 ms
52,812 KB |
testcase_07 | AC | 133 ms
101,492 KB |
testcase_08 | AC | 114 ms
102,192 KB |
testcase_09 | RE | - |
testcase_10 | AC | 523 ms
160,480 KB |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | AC | 738 ms
168,576 KB |
testcase_14 | AC | 737 ms
178,552 KB |
testcase_15 | AC | 722 ms
165,692 KB |
testcase_16 | RE | - |
testcase_17 | AC | 710 ms
168,324 KB |
testcase_18 | AC | 60 ms
67,204 KB |
testcase_19 | AC | 65 ms
69,584 KB |
testcase_20 | AC | 64 ms
70,100 KB |
testcase_21 | AC | 65 ms
70,296 KB |
testcase_22 | AC | 698 ms
165,272 KB |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | AC | 636 ms
153,536 KB |
testcase_26 | AC | 660 ms
162,000 KB |
testcase_27 | AC | 40 ms
52,568 KB |
testcase_28 | AC | 39 ms
52,744 KB |
testcase_29 | RE | - |
testcase_30 | AC | 38 ms
52,544 KB |
testcase_31 | AC | 40 ms
53,252 KB |
testcase_32 | AC | 40 ms
52,824 KB |
testcase_33 | AC | 39 ms
53,972 KB |
testcase_34 | AC | 40 ms
52,912 KB |
testcase_35 | RE | - |
testcase_36 | AC | 40 ms
52,396 KB |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | AC | 527 ms
133,200 KB |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
ソースコード
import sys;input=sys.stdin.readline def gcd(a, b): if a < b: a, b = b, a if b == 0: return a while a % b: a, b = b, a%b return b n = int(input()) X = list(map(int, input().split())) st_f = [(0, 0), (X[0], X[0])] st_b = [(0, 0)] r = 0 j = 1 for i in range(n): while True: if gcd(st_f[-1][1], st_b[-1][1]) == 1: break if j == n: j += 1 break st_f.append( (X[j], gcd(st_f[-1][1], X[j])) ) j += 1 if len(st_b) == 1: while len(st_f) > 1: x, y = st_f.pop() st_b.append( (x, gcd(st_b[-1][1], x)) ) st_b.pop() r += n-j+1 print(r)