結果

問題 No.854 公平なりんご分配
ユーザー rlangevinrlangevin
提出日時 2023-10-23 21:47:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,185 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 225,152 KB
最終ジャッジ日時 2023-10-23 21:47:44
合計ジャッジ時間 17,233 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
169,768 KB
testcase_01 AC 48 ms
59,752 KB
testcase_02 AC 42 ms
58,976 KB
testcase_03 AC 46 ms
62,000 KB
testcase_04 AC 42 ms
58,976 KB
testcase_05 AC 46 ms
61,720 KB
testcase_06 AC 44 ms
59,752 KB
testcase_07 AC 44 ms
59,752 KB
testcase_08 AC 45 ms
61,720 KB
testcase_09 AC 44 ms
59,752 KB
testcase_10 AC 47 ms
62,000 KB
testcase_11 AC 47 ms
61,720 KB
testcase_12 AC 48 ms
62,044 KB
testcase_13 AC 48 ms
62,044 KB
testcase_14 AC 43 ms
58,976 KB
testcase_15 AC 47 ms
62,044 KB
testcase_16 AC 48 ms
62,044 KB
testcase_17 AC 48 ms
62,044 KB
testcase_18 AC 48 ms
62,044 KB
testcase_19 AC 48 ms
62,044 KB
testcase_20 AC 48 ms
62,044 KB
testcase_21 AC 47 ms
62,044 KB
testcase_22 AC 70 ms
70,624 KB
testcase_23 AC 63 ms
68,308 KB
testcase_24 AC 98 ms
80,568 KB
testcase_25 AC 63 ms
68,320 KB
testcase_26 AC 97 ms
80,820 KB
testcase_27 AC 70 ms
72,412 KB
testcase_28 AC 71 ms
70,608 KB
testcase_29 AC 55 ms
66,236 KB
testcase_30 AC 60 ms
68,292 KB
testcase_31 AC 98 ms
79,980 KB
testcase_32 AC 347 ms
177,348 KB
testcase_33 AC 306 ms
130,380 KB
testcase_34 AC 562 ms
216,384 KB
testcase_35 AC 430 ms
186,212 KB
testcase_36 AC 158 ms
82,516 KB
testcase_37 AC 327 ms
170,976 KB
testcase_38 AC 294 ms
152,376 KB
testcase_39 AC 561 ms
225,152 KB
testcase_40 AC 266 ms
122,208 KB
testcase_41 AC 343 ms
163,596 KB
testcase_42 AC 513 ms
214,136 KB
testcase_43 AC 392 ms
167,584 KB
testcase_44 AC 540 ms
203,464 KB
testcase_45 AC 274 ms
100,408 KB
testcase_46 AC 490 ms
201,744 KB
testcase_47 AC 300 ms
145,092 KB
testcase_48 AC 507 ms
212,288 KB
testcase_49 AC 443 ms
214,864 KB
testcase_50 AC 364 ms
169,984 KB
testcase_51 AC 491 ms
208,084 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(2000)
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
        v = Prime[i]
        while P % v == 0:
            cnt += 1
            P //= v
        if cnt == 0:
            continue
        if cnt > Dc[i][R] - Dc[i][L]:
            print("NO")
            break
    else:
        print("Yes") if P == 1 else print("NO")
0