結果

問題 No.854 公平なりんご分配
ユーザー rlangevinrlangevin
提出日時 2023-10-23 21:40:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,136 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 285,220 KB
最終ジャッジ日時 2023-10-23 21:41:00
合計ジャッジ時間 23,735 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
62,112 KB
testcase_01 AC 52 ms
62,212 KB
testcase_02 AC 49 ms
61,972 KB
testcase_03 AC 50 ms
62,244 KB
testcase_04 AC 46 ms
59,432 KB
testcase_05 AC 51 ms
62,248 KB
testcase_06 AC 49 ms
62,184 KB
testcase_07 AC 48 ms
62,184 KB
testcase_08 AC 51 ms
62,248 KB
testcase_09 AC 49 ms
62,184 KB
testcase_10 AC 51 ms
62,244 KB
testcase_11 AC 50 ms
62,248 KB
testcase_12 AC 51 ms
62,248 KB
testcase_13 AC 51 ms
62,248 KB
testcase_14 AC 50 ms
61,972 KB
testcase_15 AC 51 ms
62,248 KB
testcase_16 AC 51 ms
62,248 KB
testcase_17 AC 52 ms
62,248 KB
testcase_18 AC 52 ms
62,248 KB
testcase_19 AC 53 ms
62,248 KB
testcase_20 AC 52 ms
62,248 KB
testcase_21 AC 51 ms
62,248 KB
testcase_22 AC 83 ms
72,888 KB
testcase_23 AC 73 ms
70,568 KB
testcase_24 AC 116 ms
82,524 KB
testcase_25 AC 76 ms
72,880 KB
testcase_26 AC 112 ms
82,700 KB
testcase_27 AC 84 ms
73,620 KB
testcase_28 AC 79 ms
70,820 KB
testcase_29 AC 62 ms
66,452 KB
testcase_30 AC 72 ms
70,796 KB
testcase_31 AC 111 ms
81,804 KB
testcase_32 AC 533 ms
219,340 KB
testcase_33 AC 527 ms
153,020 KB
testcase_34 AC 969 ms
273,164 KB
testcase_35 AC 716 ms
231,796 KB
testcase_36 AC 254 ms
85,532 KB
testcase_37 AC 478 ms
210,504 KB
testcase_38 AC 451 ms
184,828 KB
testcase_39 AC 1,129 ms
285,220 KB
testcase_40 AC 485 ms
141,444 KB
testcase_41 AC 586 ms
200,160 KB
testcase_42 AC 823 ms
269,508 KB
testcase_43 AC 801 ms
206,144 KB
testcase_44 AC 965 ms
256,280 KB
testcase_45 AC 679 ms
111,040 KB
testcase_46 AC 1,016 ms
253,812 KB
testcase_47 AC 491 ms
174,620 KB
testcase_48 AC 815 ms
266,604 KB
testcase_49 AC 683 ms
271,092 KB
testcase_50 AC 515 ms
209,172 KB
testcase_51 AC 1,038 ms
261,868 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
        if P == 1:
            print("Yes")
            break
        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