結果

問題 No.1036 Make One With GCD 2
ユーザー maspymaspy
提出日時 2020-04-25 16:57:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 304 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 156,856 KB
最終ジャッジ日時 2024-04-25 10:40:00
合計ジャッジ時間 52,334 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,322 ms
155,724 KB
testcase_01 AC 1,068 ms
149,472 KB
testcase_02 AC 1,174 ms
149,708 KB
testcase_03 AC 582 ms
81,100 KB
testcase_04 AC 692 ms
109,912 KB
testcase_05 AC 507 ms
43,944 KB
testcase_06 AC 509 ms
44,204 KB
testcase_07 AC 678 ms
89,296 KB
testcase_08 AC 639 ms
80,640 KB
testcase_09 AC 1,089 ms
146,892 KB
testcase_10 AC 1,036 ms
139,940 KB
testcase_11 AC 1,112 ms
150,312 KB
testcase_12 AC 1,050 ms
141,260 KB
testcase_13 AC 1,203 ms
144,472 KB
testcase_14 AC 1,220 ms
145,820 KB
testcase_15 AC 1,163 ms
140,900 KB
testcase_16 AC 1,170 ms
140,572 KB
testcase_17 AC 1,211 ms
144,664 KB
testcase_18 AC 462 ms
44,216 KB
testcase_19 AC 468 ms
44,204 KB
testcase_20 AC 472 ms
44,072 KB
testcase_21 AC 476 ms
44,460 KB
testcase_22 AC 1,142 ms
138,100 KB
testcase_23 AC 961 ms
113,256 KB
testcase_24 AC 1,207 ms
141,800 KB
testcase_25 AC 1,090 ms
132,684 KB
testcase_26 AC 1,148 ms
136,524 KB
testcase_27 AC 483 ms
44,204 KB
testcase_28 AC 465 ms
44,328 KB
testcase_29 AC 481 ms
44,328 KB
testcase_30 AC 532 ms
44,200 KB
testcase_31 AC 532 ms
44,148 KB
testcase_32 AC 544 ms
44,328 KB
testcase_33 AC 472 ms
44,200 KB
testcase_34 AC 463 ms
43,944 KB
testcase_35 AC 466 ms
44,076 KB
testcase_36 AC 468 ms
44,200 KB
testcase_37 AC 473 ms
43,940 KB
testcase_38 AC 1,115 ms
151,100 KB
testcase_39 AC 1,616 ms
150,292 KB
testcase_40 AC 951 ms
113,308 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from numpy import *
N=int(input())
A=int64(input().split()+[1])
s=ones((20,N+1),int64)
s[0]=A
for n in range(19):
  d=1<<n
  s[n+1,:-d]=gcd(s[n,:-d],s[n,d:])
L=arange(N)
R=copy(L)
G=zeros(N,int64)
for n in range(19, -1, -1):
  H=gcd(G,s[n][R])
  g=H!=1
  R[g]+=1<<n
  G[g]=H[g]
print(N*(N+1)//2-sum(R-L))
0