結果

問題 No.854 公平なりんご分配
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-05-20 13:00:41
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 934 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 81,860 KB
実行使用メモリ 155,404 KB
最終ジャッジ日時 2023-10-20 00:58:34
合計ジャッジ時間 17,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,200 KB
testcase_01 AC 42 ms
59,520 KB
testcase_02 AC 44 ms
59,356 KB
testcase_03 AC 44 ms
61,588 KB
testcase_04 AC 43 ms
59,356 KB
testcase_05 AC 45 ms
61,588 KB
testcase_06 AC 42 ms
59,520 KB
testcase_07 AC 44 ms
61,588 KB
testcase_08 AC 46 ms
61,588 KB
testcase_09 AC 44 ms
61,588 KB
testcase_10 AC 45 ms
59,520 KB
testcase_11 AC 48 ms
61,588 KB
testcase_12 AC 45 ms
61,588 KB
testcase_13 AC 45 ms
61,588 KB
testcase_14 AC 43 ms
59,356 KB
testcase_15 AC 44 ms
61,588 KB
testcase_16 AC 47 ms
61,588 KB
testcase_17 AC 45 ms
61,588 KB
testcase_18 AC 43 ms
61,568 KB
testcase_19 AC 45 ms
61,588 KB
testcase_20 AC 44 ms
61,568 KB
testcase_21 AC 46 ms
61,588 KB
testcase_22 AC 67 ms
70,324 KB
testcase_23 AC 65 ms
70,324 KB
testcase_24 AC 80 ms
73,676 KB
testcase_25 AC 64 ms
68,276 KB
testcase_26 AC 89 ms
78,312 KB
testcase_27 AC 72 ms
72,384 KB
testcase_28 AC 64 ms
70,316 KB
testcase_29 AC 54 ms
66,032 KB
testcase_30 AC 65 ms
68,268 KB
testcase_31 AC 87 ms
77,784 KB
testcase_32 AC 299 ms
127,156 KB
testcase_33 AC 287 ms
101,772 KB
testcase_34 AC 508 ms
143,476 KB
testcase_35 AC 371 ms
133,680 KB
testcase_36 AC 191 ms
79,056 KB
testcase_37 AC 297 ms
125,440 KB
testcase_38 AC 244 ms
115,952 KB
testcase_39 AC 621 ms
155,404 KB
testcase_40 AC 331 ms
100,008 KB
testcase_41 AC 350 ms
122,888 KB
testcase_42 AC 436 ms
146,376 KB
testcase_43 AC 482 ms
125,880 KB
testcase_44 AC 477 ms
141,532 KB
testcase_45 AC 404 ms
93,268 KB
testcase_46 AC 583 ms
143,904 KB
testcase_47 AC 292 ms
112,664 KB
testcase_48 AC 432 ms
147,260 KB
testcase_49 AC 403 ms
148,620 KB
testcase_50 AC 279 ms
125,016 KB
testcase_51 AC 570 ms
147,064 KB
testcase_52 TLE -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
q = int(input())
P = []
LR = []
for i in range(q):
    p,l,r = map(int,input().split())
    P.append(p)
    LR.append([l-1,r])

M = 2*10**3+5
count = [0]*M
primes = []
for i in range(2,M):
    if count[i]:
        continue
    primes.append(i)
    for j in range(i,M,i):
        count[j] += 1

accum = [[0]*(len(primes)) for i in range(n+1)]
zero = [0]*(n+1)
for i,a in enumerate(A,1):
    zero[i] = zero[i-1]+int(a==0)
    for j,p in enumerate(primes):
        accum[i][j] = accum[i-1][j]
        while a%p == 0:
            a //= p
            accum[i][j] += 1

for p,(l,r) in zip(P,LR):
    if zero[r]-zero[l]:
        print("Yes")
        continue

    for j,d in enumerate(primes):
        
        num = accum[r][j]-accum[l][j]

        while num and p%d == 0:
            p //= d
            num -= 1
    print("Yes" if p == 1 else "NO")
0