結果

問題 No.854 公平なりんご分配
ユーザー rlangevinrlangevin
提出日時 2023-10-23 21:35:00
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,074 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 80,700 KB
実行使用メモリ 281,620 KB
最終ジャッジ日時 2023-10-23 21:35:26
合計ジャッジ時間 25,644 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
61,892 KB
testcase_01 AC 51 ms
62,136 KB
testcase_02 AC 48 ms
61,892 KB
testcase_03 AC 50 ms
62,168 KB
testcase_04 AC 44 ms
59,356 KB
testcase_05 AC 48 ms
62,172 KB
testcase_06 AC 46 ms
62,108 KB
testcase_07 AC 47 ms
62,108 KB
testcase_08 AC 49 ms
62,172 KB
testcase_09 AC 48 ms
62,108 KB
testcase_10 AC 50 ms
62,168 KB
testcase_11 AC 52 ms
62,172 KB
testcase_12 AC 51 ms
62,172 KB
testcase_13 AC 50 ms
62,172 KB
testcase_14 AC 48 ms
61,892 KB
testcase_15 AC 50 ms
62,172 KB
testcase_16 AC 51 ms
62,172 KB
testcase_17 AC 51 ms
62,172 KB
testcase_18 AC 50 ms
62,172 KB
testcase_19 AC 51 ms
62,172 KB
testcase_20 AC 49 ms
62,172 KB
testcase_21 AC 49 ms
62,172 KB
testcase_22 AC 82 ms
73,384 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 77 ms
72,876 KB
testcase_29 AC 58 ms
66,416 KB
testcase_30 AC 68 ms
68,480 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
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(N):
        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