結果

問題 No.854 公平なりんご分配
ユーザー convexineqconvexineq
提出日時 2021-03-26 06:12:23
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,397 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 319,076 KB
最終ジャッジ日時 2024-05-05 16:44:53
合計ジャッジ時間 24,586 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
63,744 KB
testcase_01 AC 59 ms
65,664 KB
testcase_02 AC 54 ms
64,000 KB
testcase_03 AC 56 ms
65,608 KB
testcase_04 AC 53 ms
64,384 KB
testcase_05 AC 55 ms
64,512 KB
testcase_06 AC 55 ms
64,896 KB
testcase_07 AC 57 ms
64,896 KB
testcase_08 AC 56 ms
64,512 KB
testcase_09 AC 55 ms
65,280 KB
testcase_10 AC 55 ms
65,408 KB
testcase_11 AC 55 ms
65,024 KB
testcase_12 AC 60 ms
66,048 KB
testcase_13 AC 58 ms
65,920 KB
testcase_14 AC 54 ms
64,128 KB
testcase_15 AC 55 ms
65,408 KB
testcase_16 AC 58 ms
66,176 KB
testcase_17 AC 57 ms
66,232 KB
testcase_18 AC 56 ms
65,792 KB
testcase_19 AC 56 ms
65,664 KB
testcase_20 AC 56 ms
65,280 KB
testcase_21 AC 56 ms
65,536 KB
testcase_22 AC 81 ms
75,192 KB
testcase_23 AC 71 ms
72,320 KB
testcase_24 AC 90 ms
79,340 KB
testcase_25 AC 64 ms
69,248 KB
testcase_26 AC 97 ms
79,488 KB
testcase_27 AC 80 ms
75,144 KB
testcase_28 AC 83 ms
75,520 KB
testcase_29 AC 61 ms
67,472 KB
testcase_30 AC 67 ms
69,504 KB
testcase_31 AC 95 ms
79,028 KB
testcase_32 AC 201 ms
129,068 KB
testcase_33 AC 204 ms
104,084 KB
testcase_34 AC 288 ms
149,376 KB
testcase_35 AC 248 ms
133,520 KB
testcase_36 AC 178 ms
80,644 KB
testcase_37 AC 187 ms
125,952 KB
testcase_38 AC 171 ms
115,720 KB
testcase_39 AC 371 ms
154,240 KB
testcase_40 AC 212 ms
100,024 KB
testcase_41 AC 225 ms
122,084 KB
testcase_42 AC 272 ms
148,268 KB
testcase_43 AC 308 ms
123,716 KB
testcase_44 AC 325 ms
142,432 KB
testcase_45 AC 291 ms
89,620 KB
testcase_46 AC 346 ms
142,080 KB
testcase_47 AC 198 ms
112,084 KB
testcase_48 AC 266 ms
146,948 KB
testcase_49 AC 250 ms
148,528 KB
testcase_50 AC 187 ms
125,100 KB
testcase_51 AC 366 ms
144,672 KB
testcase_52 AC 246 ms
106,216 KB
testcase_53 AC 178 ms
105,564 KB
testcase_54 AC 235 ms
111,232 KB
testcase_55 AC 161 ms
106,112 KB
testcase_56 AC 166 ms
107,160 KB
testcase_57 AC 186 ms
101,376 KB
testcase_58 AC 274 ms
87,272 KB
testcase_59 AC 167 ms
98,804 KB
testcase_60 AC 210 ms
101,884 KB
testcase_61 AC 145 ms
81,440 KB
testcase_62 AC 212 ms
97,200 KB
testcase_63 AC 176 ms
98,712 KB
testcase_64 AC 162 ms
85,968 KB
testcase_65 AC 220 ms
139,208 KB
testcase_66 AC 170 ms
92,800 KB
testcase_67 AC 209 ms
115,568 KB
testcase_68 AC 213 ms
93,824 KB
testcase_69 AC 215 ms
153,780 KB
testcase_70 AC 153 ms
100,616 KB
testcase_71 AC 158 ms
102,844 KB
testcase_72 AC 202 ms
81,384 KB
testcase_73 AC 190 ms
126,208 KB
testcase_74 AC 251 ms
137,728 KB
testcase_75 AC 201 ms
103,276 KB
testcase_76 AC 209 ms
123,544 KB
testcase_77 AC 249 ms
146,176 KB
testcase_78 AC 280 ms
95,432 KB
testcase_79 AC 232 ms
116,844 KB
testcase_80 AC 240 ms
119,340 KB
testcase_81 AC 197 ms
122,112 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)
M = len(primes)
v = [[] for _ in range(2001)]
for i in range(M):
    p = primes[i]
    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((i*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[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 in range(M):
        pi = primes[i]
        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