結果
問題 | No.854 公平なりんご分配 |
ユーザー | H3PO4 |
提出日時 | 2021-02-27 10:28:07 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,673 bytes |
コンパイル時間 | 754 ms |
コンパイル使用メモリ | 81,904 KB |
実行使用メモリ | 335,336 KB |
最終ジャッジ日時 | 2024-10-02 17:09:23 |
合計ジャッジ時間 | 55,490 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
66,252 KB |
testcase_01 | AC | 47 ms
61,128 KB |
testcase_02 | AC | 45 ms
59,472 KB |
testcase_03 | AC | 48 ms
61,416 KB |
testcase_04 | AC | 45 ms
59,976 KB |
testcase_05 | AC | 48 ms
60,580 KB |
testcase_06 | AC | 46 ms
60,940 KB |
testcase_07 | AC | 46 ms
60,148 KB |
testcase_08 | AC | 46 ms
60,292 KB |
testcase_09 | AC | 47 ms
60,788 KB |
testcase_10 | AC | 47 ms
60,740 KB |
testcase_11 | AC | 47 ms
60,048 KB |
testcase_12 | AC | 51 ms
63,048 KB |
testcase_13 | AC | 51 ms
62,004 KB |
testcase_14 | AC | 44 ms
59,356 KB |
testcase_15 | AC | 48 ms
61,320 KB |
testcase_16 | AC | 51 ms
63,792 KB |
testcase_17 | AC | 52 ms
63,264 KB |
testcase_18 | AC | 48 ms
60,836 KB |
testcase_19 | AC | 49 ms
60,828 KB |
testcase_20 | AC | 47 ms
61,268 KB |
testcase_21 | AC | 48 ms
61,820 KB |
testcase_22 | AC | 85 ms
73,976 KB |
testcase_23 | AC | 79 ms
72,304 KB |
testcase_24 | AC | 118 ms
79,108 KB |
testcase_25 | AC | 71 ms
70,520 KB |
testcase_26 | AC | 119 ms
79,436 KB |
testcase_27 | AC | 104 ms
79,028 KB |
testcase_28 | AC | 84 ms
73,632 KB |
testcase_29 | AC | 59 ms
65,692 KB |
testcase_30 | AC | 73 ms
70,580 KB |
testcase_31 | AC | 121 ms
79,216 KB |
testcase_32 | AC | 390 ms
128,632 KB |
testcase_33 | AC | 685 ms
105,948 KB |
testcase_34 | AC | 1,003 ms
149,196 KB |
testcase_35 | AC | 682 ms
133,400 KB |
testcase_36 | AC | 372 ms
82,852 KB |
testcase_37 | AC | 404 ms
125,272 KB |
testcase_38 | AC | 313 ms
116,008 KB |
testcase_39 | AC | 1,765 ms
154,972 KB |
testcase_40 | AC | 829 ms
102,600 KB |
testcase_41 | AC | 755 ms
122,580 KB |
testcase_42 | AC | 803 ms
147,204 KB |
testcase_43 | AC | 1,268 ms
126,044 KB |
testcase_44 | AC | 1,244 ms
143,088 KB |
testcase_45 | AC | 1,417 ms
93,276 KB |
testcase_46 | AC | 1,700 ms
143,920 KB |
testcase_47 | AC | 600 ms
113,572 KB |
testcase_48 | AC | 728 ms
146,524 KB |
testcase_49 | AC | 632 ms
147,088 KB |
testcase_50 | AC | 331 ms
125,840 KB |
testcase_51 | AC | 1,674 ms
146,808 KB |
testcase_52 | AC | 956 ms
110,048 KB |
testcase_53 | AC | 459 ms
108,128 KB |
testcase_54 | AC | 932 ms
115,368 KB |
testcase_55 | AC | 290 ms
106,816 KB |
testcase_56 | AC | 283 ms
107,676 KB |
testcase_57 | AC | 557 ms
103,000 KB |
testcase_58 | AC | 1,173 ms
90,768 KB |
testcase_59 | AC | 283 ms
99,228 KB |
testcase_60 | AC | 684 ms
103,844 KB |
testcase_61 | AC | 283 ms
83,572 KB |
testcase_62 | AC | 862 ms
100,164 KB |
testcase_63 | AC | 441 ms
101,584 KB |
testcase_64 | AC | 294 ms
86,420 KB |
testcase_65 | AC | 428 ms
138,700 KB |
testcase_66 | AC | 515 ms
95,160 KB |
testcase_67 | AC | 623 ms
118,980 KB |
testcase_68 | AC | 714 ms
97,460 KB |
testcase_69 | AC | 312 ms
153,868 KB |
testcase_70 | AC | 275 ms
102,260 KB |
testcase_71 | AC | 297 ms
104,488 KB |
testcase_72 | AC | 446 ms
83,336 KB |
testcase_73 | AC | 322 ms
127,016 KB |
testcase_74 | AC | 725 ms
139,980 KB |
testcase_75 | AC | 549 ms
104,844 KB |
testcase_76 | AC | 480 ms
127,284 KB |
testcase_77 | AC | 495 ms
147,584 KB |
testcase_78 | AC | 1,145 ms
99,864 KB |
testcase_79 | AC | 818 ms
120,816 KB |
testcase_80 | AC | 768 ms
122,120 KB |
testcase_81 | AC | 453 ms
123,836 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 | -- | - |
ソースコード
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]) def factorization(n): arr = dict() temp = n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr[i] = cnt if temp != 1: arr[temp] = 1 if not arr and n != 1: arr[n] = 1 return arr N = int(input()) A = tuple(map(int, input().split())) Q = int(input()) queries = [tuple(map(int, input().split())) for _ in range(Q)] P = tuple(primes(2000)) acc_list = [[0] * (N + 1) for _ in range(len(P))] p2i = {pr: i for i, pr in enumerate(P)} INF = 10 ** 7 for i, a in enumerate(A, 1): if a: for k, v in factorization(a).items(): acc_list[p2i[k]][i] += v else: for p in range(len(P)): acc_list[p][i] = INF for p in range(len(P)): for i in range(N): acc_list[p][i + 1] += acc_list[p][i] for p, l, r in queries: temp = p for pr in P: ct = 0 while not temp % pr: temp //= pr ct += 1 diff = acc_list[p2i[pr]][r] - acc_list[p2i[pr]][l - 1] if diff >= INF: print('Yes') break elif diff < ct: print('NO') break else: print('Yes' if temp == 1 else 'NO')