結果

問題 No.854 公平なりんご分配
ユーザー rlangevinrlangevin
提出日時 2023-10-23 21:37:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,074 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,760 KB
実行使用メモリ 284,840 KB
最終ジャッジ日時 2023-10-23 21:38:18
合計ジャッジ時間 31,094 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
61,904 KB
testcase_01 AC 54 ms
62,188 KB
testcase_02 AC 50 ms
62,024 KB
testcase_03 AC 50 ms
62,220 KB
testcase_04 AC 43 ms
59,412 KB
testcase_05 AC 51 ms
62,224 KB
testcase_06 AC 47 ms
62,160 KB
testcase_07 AC 48 ms
62,160 KB
testcase_08 AC 49 ms
62,224 KB
testcase_09 AC 47 ms
62,160 KB
testcase_10 AC 49 ms
62,220 KB
testcase_11 AC 51 ms
64,304 KB
testcase_12 AC 53 ms
64,304 KB
testcase_13 AC 53 ms
64,304 KB
testcase_14 AC 48 ms
61,948 KB
testcase_15 AC 49 ms
62,224 KB
testcase_16 AC 52 ms
64,304 KB
testcase_17 AC 52 ms
64,304 KB
testcase_18 AC 50 ms
62,224 KB
testcase_19 AC 52 ms
64,304 KB
testcase_20 AC 49 ms
62,224 KB
testcase_21 AC 49 ms
62,224 KB
testcase_22 AC 87 ms
73,416 KB
testcase_23 AC 77 ms
72,844 KB
testcase_24 AC 110 ms
82,700 KB
testcase_25 AC 72 ms
72,860 KB
testcase_26 AC 116 ms
82,712 KB
testcase_27 AC 94 ms
82,796 KB
testcase_28 AC 79 ms
72,888 KB
testcase_29 AC 62 ms
68,732 KB
testcase_30 AC 66 ms
68,500 KB
testcase_31 AC 104 ms
81,752 KB
testcase_32 AC 652 ms
219,336 KB
testcase_33 AC 838 ms
153,004 KB
testcase_34 AC 1,300 ms
272,904 KB
testcase_35 AC 935 ms
231,800 KB
testcase_36 AC 297 ms
85,512 KB
testcase_37 AC 599 ms
210,748 KB
testcase_38 AC 476 ms
184,812 KB
testcase_39 AC 1,802 ms
284,840 KB
testcase_40 AC 967 ms
141,468 KB
testcase_41 AC 852 ms
200,288 KB
testcase_42 AC 1,106 ms
269,496 KB
testcase_43 AC 1,407 ms
206,184 KB
testcase_44 AC 1,391 ms
256,332 KB
testcase_45 AC 1,117 ms
111,028 KB
testcase_46 AC 1,717 ms
253,696 KB
testcase_47 AC 691 ms
174,612 KB
testcase_48 AC 1,016 ms
266,592 KB
testcase_49 AC 859 ms
270,816 KB
testcase_50 AC 577 ms
209,524 KB
testcase_51 AC 1,684 ms
261,856 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

from math import *

def Sieve(n):
    lst = [True] * (n + 1)
    S = set()
    for i in range(2, ceil(sqrt(n)) + 1):
        if lst[i]:
            for j in range(2 * i, n + 1, i):
                lst[j] = False
    for i in range(2, n + 1):
        if lst[i]:
            S.add(i)
    return sorted(list(S))

N = int(input())
A = list(map(int, input().split()))
Prime = Sieve(3000)
M = len(Prime)
D = [[0] * N for _ in range(M)]
Dc = [[0] * (N + 1) for _ in range(M)]
for i in range(M):
    for j in range(N):
        while A[j] % Prime[i] == 0:
            A[j] //= Prime[i]
            D[i][j] += 1
              
    for j in range(N):
        Dc[i][j + 1] = Dc[i][j] + D[i][j]
        
Q = int(input())
for _ in range(Q):
    P, L, R = map(int, input().split())
    L -= 1
    for i in range(M):
        cnt = 0
        while P % Prime[i] == 0:
            cnt += 1
            P //= Prime[i]
        if cnt > Dc[i][R] - Dc[i][L]:
            print("NO")
            break
    else:
        print("Yes") if P == 1 else print("NO")
0