結果
問題 | No.854 公平なりんご分配 |
ユーザー | H3PO4 |
提出日時 | 2021-02-27 10:38:18 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,394 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 82,576 KB |
実行使用メモリ | 383,284 KB |
最終ジャッジ日時 | 2024-10-02 17:10:30 |
合計ジャッジ時間 | 55,017 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 37 ms
53,940 KB |
testcase_02 | AC | 37 ms
53,012 KB |
testcase_03 | AC | 37 ms
52,404 KB |
testcase_04 | AC | 37 ms
52,888 KB |
testcase_05 | AC | 37 ms
53,488 KB |
testcase_06 | AC | 37 ms
53,480 KB |
testcase_07 | AC | 37 ms
52,904 KB |
testcase_08 | AC | 38 ms
53,768 KB |
testcase_09 | AC | 37 ms
53,140 KB |
testcase_10 | AC | 38 ms
53,132 KB |
testcase_11 | AC | 38 ms
53,552 KB |
testcase_12 | AC | 43 ms
61,420 KB |
testcase_13 | AC | 43 ms
60,412 KB |
testcase_14 | AC | 37 ms
53,320 KB |
testcase_15 | AC | 39 ms
53,884 KB |
testcase_16 | AC | 44 ms
61,092 KB |
testcase_17 | AC | 44 ms
60,788 KB |
testcase_18 | AC | 44 ms
60,064 KB |
testcase_19 | AC | 43 ms
60,396 KB |
testcase_20 | AC | 44 ms
59,896 KB |
testcase_21 | AC | 44 ms
60,708 KB |
testcase_22 | AC | 85 ms
75,448 KB |
testcase_23 | AC | 75 ms
71,788 KB |
testcase_24 | AC | 110 ms
79,064 KB |
testcase_25 | AC | 69 ms
69,252 KB |
testcase_26 | AC | 110 ms
79,324 KB |
testcase_27 | AC | 87 ms
73,956 KB |
testcase_28 | AC | 85 ms
74,828 KB |
testcase_29 | AC | 61 ms
67,216 KB |
testcase_30 | AC | 71 ms
69,716 KB |
testcase_31 | AC | 110 ms
78,932 KB |
testcase_32 | AC | 471 ms
128,912 KB |
testcase_33 | AC | 526 ms
105,796 KB |
testcase_34 | AC | 889 ms
148,676 KB |
testcase_35 | AC | 647 ms
133,388 KB |
testcase_36 | AC | 285 ms
82,012 KB |
testcase_37 | AC | 461 ms
125,612 KB |
testcase_38 | AC | 384 ms
115,872 KB |
testcase_39 | AC | 1,291 ms
154,836 KB |
testcase_40 | AC | 594 ms
102,248 KB |
testcase_41 | AC | 658 ms
122,568 KB |
testcase_42 | AC | 809 ms
147,232 KB |
testcase_43 | AC | 969 ms
126,396 KB |
testcase_44 | AC | 967 ms
143,268 KB |
testcase_45 | AC | 846 ms
93,260 KB |
testcase_46 | AC | 1,268 ms
143,368 KB |
testcase_47 | AC | 504 ms
112,760 KB |
testcase_48 | AC | 752 ms
146,328 KB |
testcase_49 | AC | 692 ms
147,092 KB |
testcase_50 | AC | 394 ms
125,708 KB |
testcase_51 | AC | 1,265 ms
146,472 KB |
testcase_52 | AC | 692 ms
109,888 KB |
testcase_53 | AC | 423 ms
107,588 KB |
testcase_54 | AC | 722 ms
114,992 KB |
testcase_55 | AC | 336 ms
106,184 KB |
testcase_56 | AC | 339 ms
107,464 KB |
testcase_57 | AC | 454 ms
103,232 KB |
testcase_58 | AC | 576 ms
91,416 KB |
testcase_59 | AC | 289 ms
99,560 KB |
testcase_60 | AC | 523 ms
103,820 KB |
testcase_61 | AC | 213 ms
83,188 KB |
testcase_62 | AC | 575 ms
100,428 KB |
testcase_63 | AC | 373 ms
101,724 KB |
testcase_64 | AC | 271 ms
86,024 KB |
testcase_65 | AC | 557 ms
138,708 KB |
testcase_66 | AC | 373 ms
94,216 KB |
testcase_67 | AC | 546 ms
118,760 KB |
testcase_68 | AC | 502 ms
96,976 KB |
testcase_69 | AC | 540 ms
154,016 KB |
testcase_70 | AC | 306 ms
101,600 KB |
testcase_71 | AC | 339 ms
103,824 KB |
testcase_72 | AC | 338 ms
83,732 KB |
testcase_73 | AC | 411 ms
127,148 KB |
testcase_74 | AC | 721 ms
139,088 KB |
testcase_75 | AC | 448 ms
105,096 KB |
testcase_76 | AC | 531 ms
126,552 KB |
testcase_77 | AC | 628 ms
146,800 KB |
testcase_78 | AC | 700 ms
99,128 KB |
testcase_79 | AC | 676 ms
120,652 KB |
testcase_80 | AC | 652 ms
122,412 KB |
testcase_81 | AC | 489 ms
123,656 KB |
testcase_82 | MLE | - |
testcase_83 | MLE | - |
testcase_84 | MLE | - |
testcase_85 | AC | 1,454 ms
227,792 KB |
testcase_86 | AC | 189 ms
92,332 KB |
testcase_87 | MLE | - |
testcase_88 | MLE | - |
testcase_89 | MLE | - |
testcase_90 | MLE | - |
testcase_91 | MLE | - |
testcase_92 | TLE | - |
testcase_93 | -- | - |
ソースコード
import sys # input = sys.stdin.buffer.readline def primes(n): is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, int(n ** 0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return (i for i in range(n + 1) if is_prime[i]) N = int(input()) A = tuple(map(int, input().split())) Q = int(input()) queries = [tuple(map(int, input().split())) for _ in range(Q)] MAX = max(max(A), 1) P = tuple(primes(MAX)) L = len(P) acc_list = [[0] * (N + 1) for _ in range(L)] INF = 10 ** 7 for i, a in enumerate(A, 1): if a: temp = a for x, pr in enumerate(P): ct = 0 while not temp % pr: temp //= pr ct += 1 acc_list[x][i] += ct else: for p in range(L): acc_list[p][i] = INF for p in range(L): for i in range(N): acc_list[p][i + 1] += acc_list[p][i] for p, l, r in queries: temp = p for x, pr in enumerate(P): ct = 0 while not temp % pr: temp //= pr ct += 1 diff = acc_list[x][r] - acc_list[x][l - 1] if diff >= INF: print('Yes') break elif diff < ct: print('NO') break else: print('Yes' if temp == 1 else 'NO')