結果

問題 No.854 公平なりんご分配
ユーザー kamomekamome
提出日時 2019-07-26 22:31:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,035 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 8,628 KB
最終ジャッジ日時 2023-09-15 02:25:56
合計ジャッジ時間 6,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,288 KB
testcase_01 AC 16 ms
8,228 KB
testcase_02 AC 16 ms
8,288 KB
testcase_03 AC 18 ms
8,188 KB
testcase_04 AC 17 ms
8,168 KB
testcase_05 AC 16 ms
8,124 KB
testcase_06 AC 15 ms
8,224 KB
testcase_07 AC 16 ms
8,340 KB
testcase_08 AC 16 ms
8,144 KB
testcase_09 AC 16 ms
8,284 KB
testcase_10 AC 16 ms
8,204 KB
testcase_11 AC 16 ms
7,760 KB
testcase_12 AC 16 ms
8,184 KB
testcase_13 AC 17 ms
8,108 KB
testcase_14 AC 16 ms
8,120 KB
testcase_15 AC 16 ms
8,192 KB
testcase_16 AC 17 ms
8,180 KB
testcase_17 AC 16 ms
8,344 KB
testcase_18 AC 16 ms
8,364 KB
testcase_19 AC 16 ms
8,300 KB
testcase_20 AC 16 ms
8,188 KB
testcase_21 AC 16 ms
8,308 KB
testcase_22 AC 40 ms
8,216 KB
testcase_23 AC 35 ms
8,104 KB
testcase_24 AC 84 ms
8,628 KB
testcase_25 AC 30 ms
8,200 KB
testcase_26 AC 92 ms
8,448 KB
testcase_27 AC 50 ms
8,572 KB
testcase_28 AC 40 ms
8,312 KB
testcase_29 AC 23 ms
8,284 KB
testcase_30 AC 33 ms
8,228 KB
testcase_31 AC 81 ms
8,480 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
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 #

#coding:utf-8
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

input()
boxes=list(map(int,input().split()))
b_p=[]
for b in boxes:
    dct={}
    lst_prime=prime_factors(b)
    for l in lst_prime:
        l=str(l)
        if l in dct.keys():
            dct[l]=dct[l]+1
        else:
            dct[l]=1
    b_p.append(dct)
#print(b_p)
Q=int(input())

for i in range(Q):
    _in=list(map(int,input().split()))
    P,L,R = _in[0],_in[1],_in[2]
    dct_p={}
    lst_prime=prime_factors(P)
    res=True
    for l in lst_prime:
        l=str(l)
        if l in dct_p.keys():
            dct_p[l]=dct_p[l]+1
        else:
            dct_p[l]=1
    for k in dct_p.keys():
        if dct_p[k] > sum([ x[k] if k in x.keys() else 0 for x in b_p[L-1:R]]):
            print("NO")
            res=False
            break
    if res == True:
        print("Yes")
0