結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,812 KB
testcase_01 AC 76 ms
76,896 KB
testcase_02 AC 78 ms
76,328 KB
testcase_03 AC 77 ms
76,996 KB
testcase_04 AC 75 ms
76,608 KB
testcase_05 AC 79 ms
76,876 KB
testcase_06 AC 83 ms
76,692 KB
testcase_07 AC 84 ms
77,276 KB
testcase_08 AC 85 ms
76,680 KB
testcase_09 AC 82 ms
77,148 KB
testcase_10 AC 84 ms
76,876 KB
testcase_11 AC 84 ms
76,944 KB
testcase_12 AC 82 ms
77,180 KB
testcase_13 AC 87 ms
77,004 KB
testcase_14 AC 79 ms
76,644 KB
testcase_15 AC 81 ms
76,688 KB
testcase_16 AC 81 ms
77,216 KB
testcase_17 AC 80 ms
76,868 KB
testcase_18 AC 79 ms
77,080 KB
testcase_19 AC 80 ms
77,296 KB
testcase_20 AC 80 ms
76,864 KB
testcase_21 AC 80 ms
76,852 KB
testcase_22 AC 101 ms
79,220 KB
testcase_23 AC 93 ms
78,008 KB
testcase_24 AC 108 ms
81,064 KB
testcase_25 AC 85 ms
77,068 KB
testcase_26 AC 109 ms
80,744 KB
testcase_27 AC 99 ms
80,528 KB
testcase_28 AC 101 ms
78,808 KB
testcase_29 AC 85 ms
77,240 KB
testcase_30 AC 88 ms
76,784 KB
testcase_31 AC 111 ms
80,480 KB
testcase_32 AC 211 ms
130,200 KB
testcase_33 AC 209 ms
105,388 KB
testcase_34 AC 303 ms
150,712 KB
testcase_35 AC 248 ms
134,560 KB
testcase_36 AC 197 ms
81,980 KB
testcase_37 AC 203 ms
126,660 KB
testcase_38 AC 184 ms
117,340 KB
testcase_39 AC 406 ms
155,372 KB
testcase_40 AC 229 ms
101,704 KB
testcase_41 AC 241 ms
123,088 KB
testcase_42 AC 287 ms
149,356 KB
testcase_43 AC 313 ms
125,124 KB
testcase_44 AC 328 ms
143,628 KB
testcase_45 AC 318 ms
90,600 KB
testcase_46 AC 392 ms
142,900 KB
testcase_47 AC 224 ms
113,112 KB
testcase_48 AC 289 ms
148,456 KB
testcase_49 AC 271 ms
149,820 KB
testcase_50 AC 206 ms
126,180 KB
testcase_51 AC 401 ms
146,328 KB
testcase_52 AC 294 ms
107,676 KB
testcase_53 AC 211 ms
106,724 KB
testcase_54 AC 272 ms
112,200 KB
testcase_55 AC 185 ms
106,768 KB
testcase_56 AC 189 ms
108,832 KB
testcase_57 AC 218 ms
102,836 KB
testcase_58 AC 314 ms
88,304 KB
testcase_59 AC 194 ms
100,124 KB
testcase_60 AC 244 ms
102,592 KB
testcase_61 AC 168 ms
83,368 KB
testcase_62 AC 243 ms
99,184 KB
testcase_63 AC 199 ms
99,604 KB
testcase_64 AC 191 ms
86,912 KB
testcase_65 AC 239 ms
140,372 KB
testcase_66 AC 194 ms
93,492 KB
testcase_67 AC 237 ms
117,020 KB
testcase_68 AC 250 ms
95,480 KB
testcase_69 AC 241 ms
155,260 KB
testcase_70 AC 179 ms
101,908 KB
testcase_71 AC 186 ms
104,688 KB
testcase_72 AC 236 ms
82,700 KB
testcase_73 AC 215 ms
127,652 KB
testcase_74 AC 277 ms
138,944 KB
testcase_75 AC 229 ms
105,164 KB
testcase_76 AC 235 ms
125,008 KB
testcase_77 AC 261 ms
147,988 KB
testcase_78 AC 304 ms
96,852 KB
testcase_79 AC 265 ms
117,976 KB
testcase_80 AC 266 ms
121,396 KB
testcase_81 AC 225 ms
122,908 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