結果

問題 No.854 公平なりんご分配
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-05-20 12:58:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 896 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 156,348 KB
最終ジャッジ日時 2023-10-20 00:54:58
合計ジャッジ時間 18,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,412 KB
testcase_01 AC 39 ms
59,752 KB
testcase_02 AC 40 ms
59,568 KB
testcase_03 AC 42 ms
61,820 KB
testcase_04 AC 40 ms
59,568 KB
testcase_05 AC 42 ms
61,820 KB
testcase_06 AC 39 ms
59,752 KB
testcase_07 AC 42 ms
61,820 KB
testcase_08 AC 49 ms
61,820 KB
testcase_09 AC 42 ms
61,820 KB
testcase_10 AC 47 ms
59,752 KB
testcase_11 AC 42 ms
61,820 KB
testcase_12 AC 43 ms
61,820 KB
testcase_13 AC 43 ms
61,820 KB
testcase_14 AC 40 ms
59,568 KB
testcase_15 AC 41 ms
61,820 KB
testcase_16 AC 42 ms
61,820 KB
testcase_17 AC 44 ms
61,820 KB
testcase_18 AC 42 ms
61,800 KB
testcase_19 AC 43 ms
61,820 KB
testcase_20 AC 43 ms
61,800 KB
testcase_21 AC 44 ms
61,820 KB
testcase_22 AC 71 ms
72,592 KB
testcase_23 AC 66 ms
70,532 KB
testcase_24 AC 100 ms
78,076 KB
testcase_25 AC 64 ms
70,532 KB
testcase_26 AC 90 ms
78,196 KB
testcase_27 AC 69 ms
72,592 KB
testcase_28 AC 69 ms
72,584 KB
testcase_29 AC 54 ms
66,248 KB
testcase_30 AC 65 ms
70,524 KB
testcase_31 AC 90 ms
77,840 KB
testcase_32 AC 304 ms
121,956 KB
testcase_33 AC 302 ms
105,552 KB
testcase_34 AC 482 ms
150,364 KB
testcase_35 AC 373 ms
134,432 KB
testcase_36 AC 200 ms
81,512 KB
testcase_37 AC 302 ms
122,424 KB
testcase_38 AC 256 ms
116,692 KB
testcase_39 AC 621 ms
156,348 KB
testcase_40 AC 314 ms
102,112 KB
testcase_41 AC 357 ms
123,244 KB
testcase_42 AC 476 ms
148,984 KB
testcase_43 AC 493 ms
126,432 KB
testcase_44 AC 517 ms
144,236 KB
testcase_45 AC 426 ms
92,760 KB
testcase_46 AC 590 ms
144,496 KB
testcase_47 AC 313 ms
113,428 KB
testcase_48 AC 436 ms
147,580 KB
testcase_49 AC 417 ms
148,900 KB
testcase_50 AC 291 ms
123,284 KB
testcase_51 AC 608 ms
147,608 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 #

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