結果

問題 No.854 公平なりんご分配
ユーザー convexineqconvexineq
提出日時 2021-03-26 05:50:40
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,377 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 321,276 KB
最終ジャッジ日時 2023-08-18 11:00:33
合計ジャッジ時間 42,265 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,600 KB
testcase_01 AC 82 ms
77,272 KB
testcase_02 AC 81 ms
76,480 KB
testcase_03 AC 84 ms
77,204 KB
testcase_04 AC 82 ms
76,820 KB
testcase_05 AC 83 ms
76,724 KB
testcase_06 AC 83 ms
77,248 KB
testcase_07 AC 83 ms
76,876 KB
testcase_08 AC 85 ms
76,676 KB
testcase_09 AC 82 ms
76,932 KB
testcase_10 AC 85 ms
77,204 KB
testcase_11 AC 83 ms
76,628 KB
testcase_12 AC 86 ms
77,360 KB
testcase_13 AC 89 ms
77,296 KB
testcase_14 AC 85 ms
76,952 KB
testcase_15 AC 86 ms
76,716 KB
testcase_16 AC 88 ms
76,792 KB
testcase_17 AC 88 ms
76,792 KB
testcase_18 AC 89 ms
77,200 KB
testcase_19 AC 89 ms
76,824 KB
testcase_20 AC 83 ms
77,056 KB
testcase_21 AC 83 ms
76,940 KB
testcase_22 AC 108 ms
78,956 KB
testcase_23 AC 104 ms
79,868 KB
testcase_24 AC 124 ms
81,060 KB
testcase_25 AC 93 ms
77,224 KB
testcase_26 AC 123 ms
81,052 KB
testcase_27 AC 110 ms
80,968 KB
testcase_28 AC 112 ms
78,692 KB
testcase_29 AC 89 ms
77,208 KB
testcase_30 AC 94 ms
77,288 KB
testcase_31 AC 124 ms
80,380 KB
testcase_32 AC 285 ms
129,952 KB
testcase_33 AC 407 ms
105,956 KB
testcase_34 AC 610 ms
150,972 KB
testcase_35 AC 438 ms
134,636 KB
testcase_36 AC 242 ms
82,032 KB
testcase_37 AC 275 ms
127,088 KB
testcase_38 AC 243 ms
117,272 KB
testcase_39 AC 1,009 ms
155,312 KB
testcase_40 AC 483 ms
101,692 KB
testcase_41 AC 475 ms
123,044 KB
testcase_42 AC 525 ms
149,408 KB
testcase_43 AC 757 ms
125,088 KB
testcase_44 AC 742 ms
144,020 KB
testcase_45 AC 572 ms
91,152 KB
testcase_46 AC 957 ms
143,192 KB
testcase_47 AC 356 ms
113,172 KB
testcase_48 AC 468 ms
148,684 KB
testcase_49 AC 405 ms
149,872 KB
testcase_50 AC 235 ms
126,472 KB
testcase_51 AC 963 ms
146,604 KB
testcase_52 AC 532 ms
108,152 KB
testcase_53 AC 274 ms
106,916 KB
testcase_54 AC 501 ms
112,620 KB
testcase_55 AC 207 ms
107,408 KB
testcase_56 AC 214 ms
108,444 KB
testcase_57 AC 318 ms
103,184 KB
testcase_58 AC 466 ms
88,544 KB
testcase_59 AC 218 ms
100,092 KB
testcase_60 AC 396 ms
103,112 KB
testcase_61 AC 187 ms
83,804 KB
testcase_62 AC 415 ms
99,308 KB
testcase_63 AC 266 ms
99,848 KB
testcase_64 AC 253 ms
87,296 KB
testcase_65 AC 305 ms
140,472 KB
testcase_66 AC 287 ms
94,324 KB
testcase_67 AC 362 ms
117,180 KB
testcase_68 AC 358 ms
95,392 KB
testcase_69 AC 242 ms
155,140 KB
testcase_70 AC 198 ms
101,968 KB
testcase_71 AC 209 ms
104,904 KB
testcase_72 AC 294 ms
82,548 KB
testcase_73 AC 230 ms
127,656 KB
testcase_74 AC 428 ms
139,548 KB
testcase_75 AC 318 ms
105,004 KB
testcase_76 AC 292 ms
125,288 KB
testcase_77 AC 326 ms
147,548 KB
testcase_78 AC 581 ms
97,448 KB
testcase_79 AC 456 ms
119,016 KB
testcase_80 AC 465 ms
121,556 KB
testcase_81 AC 280 ms
123,204 KB
testcase_82 MLE -
testcase_83 MLE -
testcase_84 MLE -
testcase_85 MLE -
testcase_86 MLE -
testcase_87 MLE -
testcase_88 MLE -
testcase_89 MLE -
testcase_90 MLE -
testcase_91 MLE -
testcase_92 TLE -
testcase_93 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def Eratosthenes(N): #N以下の素数のリストを返す
    N+=1
    is_prime_list = [True]*N
    m = int(N**0.5)+1
    for i in range(3,m,2):
        if is_prime_list[i]:
            is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,N,2) if is_prime_list[i]]

import sys
input = sys.stdin.readline

n = int(input())
*a, = map(int,input().split())
primes = Eratosthenes(2000)
z = {pi:i for i,pi in enumerate(primes)}
v = [[] for _ in range(2001)]
for p in primes:
    for j in range(p,2001,p):
        c = 0
        jj = j
        while jj%p==0:
            jj //= p
            c += 1
        #print(p,j)
        v[j].append((p,c))

zero = [0]*(n+1)
for i in range(n):
    if a[i]==0: zero[i] = 1
for i in range(n)[::-1]:
    zero[i] += zero[i+1]

L = len(primes)
acc = [[0]*(n+1) for _ in range(L)]
for i in range(n):
    for p,c in v[a[i]]:
        acc[z[p]][i] += c
for i in range(L):
    for j in range(n)[::-1]:
        acc[i][j] += acc[i][j+1]

Q = int(input())
for _ in range(Q):
    x,L,R = map(int,input().split())
    if zero[L-1] - zero[R]:
        print("Yes")
        continue
    for i,pi in enumerate(primes):
        c = 0
        while x%pi==0:
            x //= pi
            c += 1
        if c > acc[i][L-1] - acc[i][R]:
            print("NO")
            break
    else:
        print("Yes" if x==1 else "NO")
0