結果

問題 No.854 公平なりんご分配
ユーザー convexineqconvexineq
提出日時 2021-03-26 06:05:27
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,394 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 319,612 KB
最終ジャッジ日時 2023-08-18 11:18:31
合計ジャッジ時間 30,924 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,708 KB
testcase_01 AC 88 ms
77,048 KB
testcase_02 AC 88 ms
76,784 KB
testcase_03 AC 91 ms
76,876 KB
testcase_04 AC 89 ms
76,648 KB
testcase_05 AC 90 ms
76,856 KB
testcase_06 AC 90 ms
77,132 KB
testcase_07 AC 88 ms
77,088 KB
testcase_08 AC 90 ms
76,824 KB
testcase_09 AC 90 ms
76,780 KB
testcase_10 AC 88 ms
77,156 KB
testcase_11 AC 90 ms
76,552 KB
testcase_12 AC 92 ms
77,008 KB
testcase_13 AC 92 ms
77,280 KB
testcase_14 AC 88 ms
76,592 KB
testcase_15 AC 89 ms
76,788 KB
testcase_16 AC 92 ms
77,164 KB
testcase_17 AC 92 ms
77,100 KB
testcase_18 AC 90 ms
77,064 KB
testcase_19 AC 91 ms
76,788 KB
testcase_20 AC 91 ms
77,012 KB
testcase_21 AC 89 ms
77,260 KB
testcase_22 AC 123 ms
79,080 KB
testcase_23 AC 107 ms
77,988 KB
testcase_24 AC 122 ms
81,108 KB
testcase_25 AC 98 ms
77,124 KB
testcase_26 AC 123 ms
80,708 KB
testcase_27 AC 118 ms
80,744 KB
testcase_28 AC 119 ms
78,908 KB
testcase_29 AC 94 ms
77,248 KB
testcase_30 AC 99 ms
76,904 KB
testcase_31 AC 124 ms
80,548 KB
testcase_32 AC 233 ms
130,192 KB
testcase_33 AC 241 ms
105,608 KB
testcase_34 AC 336 ms
150,604 KB
testcase_35 AC 276 ms
134,852 KB
testcase_36 AC 219 ms
81,864 KB
testcase_37 AC 226 ms
127,196 KB
testcase_38 AC 211 ms
117,352 KB
testcase_39 AC 439 ms
155,148 KB
testcase_40 AC 254 ms
101,508 KB
testcase_41 AC 270 ms
123,076 KB
testcase_42 AC 309 ms
149,396 KB
testcase_43 AC 343 ms
125,112 KB
testcase_44 AC 359 ms
144,052 KB
testcase_45 AC 325 ms
90,800 KB
testcase_46 AC 407 ms
143,168 KB
testcase_47 AC 240 ms
113,068 KB
testcase_48 AC 306 ms
149,048 KB
testcase_49 AC 287 ms
149,784 KB
testcase_50 AC 215 ms
126,552 KB
testcase_51 AC 414 ms
146,392 KB
testcase_52 AC 304 ms
107,900 KB
testcase_53 AC 220 ms
106,568 KB
testcase_54 AC 282 ms
112,544 KB
testcase_55 AC 198 ms
106,932 KB
testcase_56 AC 203 ms
108,576 KB
testcase_57 AC 228 ms
103,104 KB
testcase_58 AC 317 ms
88,392 KB
testcase_59 AC 203 ms
100,244 KB
testcase_60 AC 254 ms
102,764 KB
testcase_61 AC 176 ms
83,336 KB
testcase_62 AC 260 ms
99,128 KB
testcase_63 AC 212 ms
100,032 KB
testcase_64 AC 192 ms
87,096 KB
testcase_65 AC 259 ms
140,364 KB
testcase_66 AC 208 ms
93,548 KB
testcase_67 AC 252 ms
117,020 KB
testcase_68 AC 255 ms
95,464 KB
testcase_69 AC 253 ms
155,392 KB
testcase_70 AC 191 ms
101,968 KB
testcase_71 AC 196 ms
104,608 KB
testcase_72 AC 248 ms
82,428 KB
testcase_73 AC 227 ms
127,784 KB
testcase_74 AC 292 ms
139,232 KB
testcase_75 AC 235 ms
105,008 KB
testcase_76 AC 244 ms
125,348 KB
testcase_77 AC 280 ms
147,872 KB
testcase_78 AC 311 ms
96,904 KB
testcase_79 AC 277 ms
118,196 KB
testcase_80 AC 279 ms
121,380 KB
testcase_81 AC 239 ms
123,128 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 MLE -
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*64+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 pc in v[a[i]]:
        acc[z[pc//64]][i] += pc%64
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 and c > acc[i][L-1] - acc[i][R]:
            print("NO")
            break
    else:
        print("Yes" if x==1 else "NO")
0