結果
問題 | No.854 公平なりんご分配 |
ユーザー | convexineq |
提出日時 | 2021-03-26 05:42:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,364 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 322,764 KB |
最終ジャッジ日時 | 2024-05-05 16:20:01 |
合計ジャッジ時間 | 47,737 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 62 ms
64,384 KB |
testcase_01 | AC | 56 ms
65,436 KB |
testcase_02 | AC | 55 ms
64,384 KB |
testcase_03 | AC | 57 ms
65,280 KB |
testcase_04 | AC | 54 ms
64,124 KB |
testcase_05 | AC | 56 ms
64,896 KB |
testcase_06 | AC | 56 ms
65,152 KB |
testcase_07 | AC | 57 ms
65,152 KB |
testcase_08 | AC | 57 ms
64,768 KB |
testcase_09 | AC | 56 ms
64,896 KB |
testcase_10 | AC | 56 ms
64,896 KB |
testcase_11 | AC | 58 ms
65,024 KB |
testcase_12 | AC | 61 ms
66,560 KB |
testcase_13 | AC | 60 ms
66,944 KB |
testcase_14 | AC | 54 ms
63,744 KB |
testcase_15 | AC | 57 ms
65,536 KB |
testcase_16 | AC | 60 ms
66,816 KB |
testcase_17 | AC | 60 ms
66,816 KB |
testcase_18 | AC | 57 ms
65,664 KB |
testcase_19 | AC | 59 ms
66,048 KB |
testcase_20 | AC | 58 ms
65,536 KB |
testcase_21 | AC | 57 ms
65,920 KB |
testcase_22 | AC | 87 ms
75,008 KB |
testcase_23 | AC | 78 ms
72,960 KB |
testcase_24 | AC | 100 ms
79,676 KB |
testcase_25 | AC | 70 ms
70,016 KB |
testcase_26 | AC | 110 ms
79,592 KB |
testcase_27 | AC | 93 ms
79,616 KB |
testcase_28 | AC | 90 ms
77,952 KB |
testcase_29 | AC | 65 ms
68,224 KB |
testcase_30 | AC | 71 ms
70,160 KB |
testcase_31 | AC | 107 ms
78,928 KB |
testcase_32 | AC | 291 ms
128,964 KB |
testcase_33 | AC | 441 ms
103,968 KB |
testcase_34 | AC | 639 ms
149,044 KB |
testcase_35 | AC | 448 ms
133,320 KB |
testcase_36 | AC | 251 ms
80,576 KB |
testcase_37 | AC | 273 ms
125,696 KB |
testcase_38 | AC | 235 ms
115,536 KB |
testcase_39 | AC | 1,091 ms
154,012 KB |
testcase_40 | AC | 517 ms
100,512 KB |
testcase_41 | AC | 491 ms
121,716 KB |
testcase_42 | AC | 584 ms
148,200 KB |
testcase_43 | AC | 841 ms
124,048 KB |
testcase_44 | AC | 794 ms
142,680 KB |
testcase_45 | AC | 830 ms
89,788 KB |
testcase_46 | AC | 1,082 ms
141,796 KB |
testcase_47 | AC | 402 ms
112,128 KB |
testcase_48 | AC | 505 ms
147,224 KB |
testcase_49 | AC | 439 ms
148,508 KB |
testcase_50 | AC | 248 ms
125,108 KB |
testcase_51 | AC | 1,055 ms
145,000 KB |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
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 | - |
ソースコード
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()) for i,pi in enumerate(primes): if zero[L-1] - zero[R]: continue 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")