結果
問題 | No.854 公平なりんご分配 |
ユーザー | qib |
提出日時 | 2022-12-29 20:23:12 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,363 bytes |
コンパイル時間 | 905 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 320,944 KB |
最終ジャッジ日時 | 2024-05-03 17:22:46 |
合計ジャッジ時間 | 41,949 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
63,488 KB |
testcase_01 | AC | 54 ms
65,152 KB |
testcase_02 | AC | 53 ms
64,000 KB |
testcase_03 | AC | 55 ms
65,664 KB |
testcase_04 | AC | 52 ms
63,488 KB |
testcase_05 | AC | 54 ms
65,216 KB |
testcase_06 | AC | 53 ms
64,512 KB |
testcase_07 | AC | 54 ms
65,152 KB |
testcase_08 | AC | 55 ms
65,152 KB |
testcase_09 | AC | 54 ms
64,640 KB |
testcase_10 | AC | 54 ms
64,896 KB |
testcase_11 | AC | 54 ms
64,768 KB |
testcase_12 | AC | 56 ms
65,408 KB |
testcase_13 | AC | 56 ms
65,792 KB |
testcase_14 | AC | 51 ms
63,744 KB |
testcase_15 | AC | 56 ms
65,792 KB |
testcase_16 | AC | 56 ms
65,408 KB |
testcase_17 | AC | 57 ms
65,700 KB |
testcase_18 | AC | 56 ms
65,536 KB |
testcase_19 | AC | 56 ms
65,536 KB |
testcase_20 | AC | 56 ms
65,152 KB |
testcase_21 | AC | 55 ms
65,408 KB |
testcase_22 | AC | 125 ms
78,196 KB |
testcase_23 | AC | 84 ms
75,008 KB |
testcase_24 | AC | 126 ms
80,392 KB |
testcase_25 | AC | 91 ms
78,592 KB |
testcase_26 | AC | 133 ms
80,304 KB |
testcase_27 | AC | 92 ms
79,104 KB |
testcase_28 | AC | 122 ms
78,592 KB |
testcase_29 | AC | 75 ms
70,784 KB |
testcase_30 | AC | 101 ms
78,720 KB |
testcase_31 | AC | 121 ms
79,316 KB |
testcase_32 | AC | 284 ms
129,496 KB |
testcase_33 | AC | 380 ms
105,108 KB |
testcase_34 | AC | 580 ms
149,576 KB |
testcase_35 | AC | 482 ms
133,464 KB |
testcase_36 | AC | 454 ms
82,056 KB |
testcase_37 | AC | 283 ms
126,264 KB |
testcase_38 | AC | 247 ms
116,396 KB |
testcase_39 | AC | 897 ms
154,428 KB |
testcase_40 | AC | 444 ms
101,648 KB |
testcase_41 | AC | 456 ms
122,576 KB |
testcase_42 | AC | 504 ms
148,140 KB |
testcase_43 | AC | 817 ms
124,956 KB |
testcase_44 | AC | 679 ms
142,668 KB |
testcase_45 | AC | 767 ms
91,652 KB |
testcase_46 | AC | 909 ms
141,848 KB |
testcase_47 | AC | 462 ms
113,804 KB |
testcase_48 | AC | 427 ms
147,164 KB |
testcase_49 | AC | 401 ms
148,520 KB |
testcase_50 | AC | 260 ms
125,460 KB |
testcase_51 | AC | 1,026 ms
145,352 KB |
testcase_52 | AC | 669 ms
107,748 KB |
testcase_53 | AC | 279 ms
106,380 KB |
testcase_54 | AC | 481 ms
112,952 KB |
testcase_55 | AC | 240 ms
106,500 KB |
testcase_56 | AC | 226 ms
107,936 KB |
testcase_57 | AC | 389 ms
102,784 KB |
testcase_58 | AC | 742 ms
89,008 KB |
testcase_59 | AC | 227 ms
99,432 KB |
testcase_60 | AC | 389 ms
102,420 KB |
testcase_61 | AC | 287 ms
83,352 KB |
testcase_62 | AC | 485 ms
98,760 KB |
testcase_63 | AC | 311 ms
99,940 KB |
testcase_64 | AC | 235 ms
86,284 KB |
testcase_65 | AC | 322 ms
139,324 KB |
testcase_66 | AC | 407 ms
94,212 KB |
testcase_67 | AC | 403 ms
117,596 KB |
testcase_68 | AC | 480 ms
95,484 KB |
testcase_69 | AC | 250 ms
153,744 KB |
testcase_70 | AC | 218 ms
101,712 KB |
testcase_71 | AC | 225 ms
104,064 KB |
testcase_72 | AC | 726 ms
83,256 KB |
testcase_73 | AC | 247 ms
127,028 KB |
testcase_74 | AC | 443 ms
137,888 KB |
testcase_75 | AC | 340 ms
104,076 KB |
testcase_76 | AC | 351 ms
124,748 KB |
testcase_77 | AC | 388 ms
146,728 KB |
testcase_78 | AC | 654 ms
98,240 KB |
testcase_79 | AC | 468 ms
118,892 KB |
testcase_80 | AC | 514 ms
121,004 KB |
testcase_81 | AC | 317 ms
122,744 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 | TLE | - |
testcase_93 | MLE | - |
ソースコード
import math n = int(input()) a = list(map(int, input().split())) m = 2000 k = int(math.sqrt(10 ** 9)) dp = [None for _ in range(k + 1)] idx = {} for x in range(2, k + 1): if not dp[x] is None: continue dp[x] = x if x <= m: idx[x] = len(idx) for y in range(2 * x, k + 1, x): if not dp[y] is None: continue dp[y] = x s = [[0 for _ in range(n + 1)] for _ in range(len(idx))] for i in range(n): cur = a[i] while cur > 1: s[idx[dp[cur]]][i + 1] += 1 cur //= dp[cur] zero = [0 for _ in range(n + 1)] for i in range(n): zero[i + 1] = zero[i] if a[i] == 0: zero[i + 1] += 1 for i in range(len(idx)): for j in range(1, n + 1): s[i][j] += s[i][j - 1] q = int(input()) ans = [None for _ in range(q)] for i in range(q): p, l, r = map(int, input().split()) l -= 1 r -= 1 if p == 1 or zero[r + 1] - zero[l] > 0: ans[i] = "Yes" continue cnt = {} cur = p flg = True for x in range(2, k + 1): if cur == 1: break if dp[x] != x or cur % x != 0: continue if x > m: flg = False break y = idx[x] cnt[y] = 0 while cur % x == 0: cnt[y] += 1 cur //= x if not flg or cur > 1: ans[i] = "NO" continue if any(s[x][r + 1] - s[x][l] < v for x, v in cnt.items()): ans[i] = "NO" else: ans[i] = "Yes" print(*ans, sep="\n")