結果

問題 No.854 公平なりんご分配
ユーザー maspymaspy
提出日時 2020-03-18 15:08:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,118 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 119,160 KB
最終ジャッジ日時 2023-08-20 19:59:15
合計ジャッジ時間 41,186 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
75,540 KB
testcase_01 AC 89 ms
76,176 KB
testcase_02 AC 65 ms
75,880 KB
testcase_03 AC 67 ms
75,900 KB
testcase_04 AC 64 ms
75,456 KB
testcase_05 AC 66 ms
75,832 KB
testcase_06 AC 65 ms
76,184 KB
testcase_07 AC 65 ms
76,104 KB
testcase_08 AC 66 ms
76,148 KB
testcase_09 AC 66 ms
75,900 KB
testcase_10 AC 69 ms
76,404 KB
testcase_11 AC 66 ms
75,892 KB
testcase_12 AC 69 ms
76,324 KB
testcase_13 AC 68 ms
76,620 KB
testcase_14 AC 66 ms
75,904 KB
testcase_15 AC 68 ms
76,384 KB
testcase_16 AC 69 ms
76,444 KB
testcase_17 AC 68 ms
76,276 KB
testcase_18 AC 68 ms
76,472 KB
testcase_19 AC 67 ms
76,324 KB
testcase_20 AC 66 ms
76,120 KB
testcase_21 AC 71 ms
76,260 KB
testcase_22 AC 79 ms
76,464 KB
testcase_23 AC 75 ms
76,716 KB
testcase_24 AC 85 ms
76,360 KB
testcase_25 AC 75 ms
76,328 KB
testcase_26 AC 83 ms
76,596 KB
testcase_27 AC 80 ms
76,684 KB
testcase_28 AC 77 ms
76,368 KB
testcase_29 AC 73 ms
76,320 KB
testcase_30 AC 72 ms
76,316 KB
testcase_31 AC 87 ms
77,036 KB
testcase_32 AC 286 ms
78,352 KB
testcase_33 AC 257 ms
79,956 KB
testcase_34 AC 432 ms
84,928 KB
testcase_35 AC 306 ms
80,536 KB
testcase_36 AC 215 ms
81,108 KB
testcase_37 AC 204 ms
78,476 KB
testcase_38 AC 210 ms
77,644 KB
testcase_39 AC 574 ms
89,316 KB
testcase_40 AC 261 ms
82,260 KB
testcase_41 AC 284 ms
80,828 KB
testcase_42 AC 394 ms
82,588 KB
testcase_43 AC 428 ms
86,204 KB
testcase_44 AC 356 ms
86,348 KB
testcase_45 AC 418 ms
89,344 KB
testcase_46 AC 520 ms
88,612 KB
testcase_47 AC 295 ms
79,628 KB
testcase_48 AC 387 ms
81,324 KB
testcase_49 AC 330 ms
80,244 KB
testcase_50 AC 220 ms
77,936 KB
testcase_51 AC 432 ms
89,004 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 AC 1,593 ms
117,760 KB
testcase_84 AC 1,263 ms
117,780 KB
testcase_85 AC 1,699 ms
117,764 KB
testcase_86 AC 855 ms
117,672 KB
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 1,434 ms
118,420 KB
testcase_93 AC 1,764 ms
118,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

INF = 100

N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
m = map(int, read().split())
P, L, R = zip(*zip(m, m, m))
P = list(P)


U = 2010
is_prime = [1] * U
is_prime[0] = 0
is_prime[1] = 0
for p in range(2, U):
    if p * p >= U:
        break
    for i in range(p * p, U, p):
        is_prime[i] = 0

ok = [1] * Q
ord_A = [0] * (N + 1)


def solve(p):
    for i in range(N):
        e = 0
        if not A[i]:
            e = 100
        else:
            while A[i] % p == 0:
                A[i] //= p
                e += 1
        ord_A[i + 1] = ord_A[i] + e
    for i in range(Q):
        e = 0
        while P[i] % p == 0:
            P[i] //= p
            e += 1
        f = ord_A[R[i]] - ord_A[L[i] - 1]
        if f < e:
            ok[i] = 0


for p in range(U):
    if is_prime[p]:
        solve(p)
for i in range(Q):
    if P[i] > 1:
        ok[i] = 0

answers = ('Yes' if x else 'NO' for x in ok)
print('\n'.join(answers))
0