結果
問題 | No.854 公平なりんご分配 |
ユーザー | H3PO4 |
提出日時 | 2021-02-27 10:39:02 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,391 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 82,056 KB |
実行使用メモリ | 383,072 KB |
最終ジャッジ日時 | 2024-10-02 17:11:39 |
合計ジャッジ時間 | 53,284 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 38 ms
52,956 KB |
testcase_02 | AC | 39 ms
54,056 KB |
testcase_03 | AC | 39 ms
53,760 KB |
testcase_04 | AC | 39 ms
53,752 KB |
testcase_05 | AC | 39 ms
53,016 KB |
testcase_06 | AC | 39 ms
52,388 KB |
testcase_07 | AC | 39 ms
53,124 KB |
testcase_08 | AC | 39 ms
53,904 KB |
testcase_09 | AC | 39 ms
53,284 KB |
testcase_10 | AC | 39 ms
52,840 KB |
testcase_11 | AC | 38 ms
53,236 KB |
testcase_12 | AC | 45 ms
59,488 KB |
testcase_13 | AC | 45 ms
60,876 KB |
testcase_14 | AC | 38 ms
53,688 KB |
testcase_15 | AC | 39 ms
53,620 KB |
testcase_16 | AC | 44 ms
60,044 KB |
testcase_17 | AC | 45 ms
59,884 KB |
testcase_18 | AC | 44 ms
59,944 KB |
testcase_19 | AC | 44 ms
60,612 KB |
testcase_20 | AC | 46 ms
61,204 KB |
testcase_21 | AC | 46 ms
61,308 KB |
testcase_22 | AC | 77 ms
73,660 KB |
testcase_23 | AC | 76 ms
71,080 KB |
testcase_24 | AC | 101 ms
79,408 KB |
testcase_25 | AC | 68 ms
68,344 KB |
testcase_26 | AC | 100 ms
79,620 KB |
testcase_27 | AC | 83 ms
72,912 KB |
testcase_28 | AC | 78 ms
73,136 KB |
testcase_29 | AC | 59 ms
66,564 KB |
testcase_30 | AC | 68 ms
67,912 KB |
testcase_31 | AC | 102 ms
79,332 KB |
testcase_32 | AC | 471 ms
128,992 KB |
testcase_33 | AC | 529 ms
103,440 KB |
testcase_34 | AC | 911 ms
149,024 KB |
testcase_35 | AC | 655 ms
133,916 KB |
testcase_36 | AC | 267 ms
82,336 KB |
testcase_37 | AC | 454 ms
125,524 KB |
testcase_38 | AC | 376 ms
115,960 KB |
testcase_39 | AC | 1,332 ms
155,352 KB |
testcase_40 | AC | 584 ms
101,504 KB |
testcase_41 | AC | 625 ms
123,328 KB |
testcase_42 | AC | 800 ms
147,632 KB |
testcase_43 | AC | 980 ms
126,236 KB |
testcase_44 | AC | 994 ms
143,032 KB |
testcase_45 | AC | 805 ms
92,988 KB |
testcase_46 | AC | 1,318 ms
142,896 KB |
testcase_47 | AC | 505 ms
113,248 KB |
testcase_48 | AC | 748 ms
147,952 KB |
testcase_49 | AC | 690 ms
149,052 KB |
testcase_50 | AC | 392 ms
125,204 KB |
testcase_51 | AC | 1,309 ms
146,316 KB |
testcase_52 | AC | 690 ms
109,872 KB |
testcase_53 | AC | 415 ms
107,372 KB |
testcase_54 | AC | 704 ms
114,684 KB |
testcase_55 | AC | 320 ms
106,656 KB |
testcase_56 | AC | 336 ms
108,196 KB |
testcase_57 | AC | 439 ms
103,168 KB |
testcase_58 | AC | 590 ms
90,408 KB |
testcase_59 | AC | 299 ms
99,480 KB |
testcase_60 | AC | 514 ms
103,496 KB |
testcase_61 | AC | 197 ms
83,296 KB |
testcase_62 | AC | 572 ms
100,080 KB |
testcase_63 | AC | 363 ms
101,072 KB |
testcase_64 | AC | 247 ms
85,704 KB |
testcase_65 | AC | 551 ms
139,672 KB |
testcase_66 | AC | 373 ms
94,588 KB |
testcase_67 | AC | 542 ms
118,680 KB |
testcase_68 | AC | 469 ms
96,900 KB |
testcase_69 | AC | 526 ms
153,692 KB |
testcase_70 | AC | 292 ms
101,844 KB |
testcase_71 | AC | 318 ms
104,364 KB |
testcase_72 | AC | 296 ms
83,168 KB |
testcase_73 | AC | 404 ms
127,408 KB |
testcase_74 | AC | 707 ms
140,072 KB |
testcase_75 | AC | 434 ms
104,536 KB |
testcase_76 | AC | 500 ms
126,464 KB |
testcase_77 | AC | 615 ms
146,788 KB |
testcase_78 | AC | 692 ms
99,072 KB |
testcase_79 | AC | 673 ms
120,588 KB |
testcase_80 | AC | 657 ms
122,084 KB |
testcase_81 | AC | 488 ms
123,348 KB |
testcase_82 | MLE | - |
testcase_83 | MLE | - |
testcase_84 | MLE | - |
testcase_85 | AC | 1,452 ms
227,724 KB |
testcase_86 | AC | 135 ms
91,904 KB |
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]) 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')