結果
問題 | No.854 公平なりんご分配 |
ユーザー | qib |
提出日時 | 2022-12-29 19:14:03 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 333 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 379,956 KB |
最終ジャッジ日時 | 2024-05-03 16:52:11 |
合計ジャッジ時間 | 40,168 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 60 ms
65,280 KB |
testcase_02 | AC | 56 ms
64,384 KB |
testcase_03 | AC | 56 ms
65,664 KB |
testcase_04 | AC | 52 ms
64,240 KB |
testcase_05 | AC | 55 ms
65,152 KB |
testcase_06 | AC | 58 ms
65,280 KB |
testcase_07 | AC | 60 ms
65,024 KB |
testcase_08 | AC | 61 ms
65,280 KB |
testcase_09 | AC | 57 ms
65,152 KB |
testcase_10 | AC | 56 ms
65,664 KB |
testcase_11 | AC | 56 ms
65,152 KB |
testcase_12 | AC | 57 ms
65,664 KB |
testcase_13 | AC | 58 ms
65,792 KB |
testcase_14 | AC | 55 ms
64,128 KB |
testcase_15 | AC | 57 ms
66,048 KB |
testcase_16 | AC | 58 ms
65,664 KB |
testcase_17 | AC | 59 ms
66,176 KB |
testcase_18 | AC | 57 ms
65,792 KB |
testcase_19 | AC | 57 ms
65,664 KB |
testcase_20 | AC | 57 ms
66,048 KB |
testcase_21 | AC | 58 ms
65,664 KB |
testcase_22 | AC | 138 ms
78,584 KB |
testcase_23 | AC | 87 ms
75,008 KB |
testcase_24 | AC | 136 ms
79,604 KB |
testcase_25 | AC | 96 ms
78,464 KB |
testcase_26 | AC | 139 ms
80,324 KB |
testcase_27 | AC | 97 ms
78,976 KB |
testcase_28 | AC | 128 ms
78,136 KB |
testcase_29 | AC | 75 ms
70,784 KB |
testcase_30 | AC | 107 ms
78,848 KB |
testcase_31 | AC | 132 ms
79,496 KB |
testcase_32 | AC | 341 ms
129,664 KB |
testcase_33 | AC | 443 ms
105,324 KB |
testcase_34 | AC | 654 ms
149,156 KB |
testcase_35 | AC | 561 ms
133,336 KB |
testcase_36 | AC | 488 ms
81,924 KB |
testcase_37 | AC | 335 ms
126,196 KB |
testcase_38 | AC | 297 ms
116,436 KB |
testcase_39 | AC | 965 ms
153,988 KB |
testcase_40 | AC | 505 ms
101,184 KB |
testcase_41 | AC | 495 ms
122,336 KB |
testcase_42 | AC | 566 ms
147,832 KB |
testcase_43 | AC | 960 ms
124,432 KB |
testcase_44 | AC | 723 ms
142,816 KB |
testcase_45 | AC | 898 ms
90,220 KB |
testcase_46 | AC | 927 ms
141,520 KB |
testcase_47 | AC | 518 ms
113,836 KB |
testcase_48 | AC | 527 ms
146,664 KB |
testcase_49 | AC | 514 ms
148,584 KB |
testcase_50 | AC | 312 ms
125,160 KB |
testcase_51 | AC | 1,200 ms
144,676 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 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
ソースコード
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)] s = {} for x in range(2, k + 1): if not dp[x] is None: continue dp[x] = x if x <= m: s[x] = [0 for _ in range(n + 1)] for y in range(2 * x, k + 1, x): if not dp[y] is None: continue dp[y] = x for i in range(n): cur = a[i] while cur > 1: s[dp[cur]][i + 1] += 1 cur //= dp[cur] for x in range(2, m + 1): if dp[x] == x: for i in range(1, n + 1): s[x][i] += s[x][i - 1] q = int(input()) for _ in range(q): p, l, r = map(int, input().split()) l -= 1 r -= 1 if p == 1: print("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 cnt[x] = 0 while cur % x == 0: cnt[x] += 1 cur //= x if not flg or cur > 1: print("NO") continue if all(s[x][r + 1] - s[x][l] >= v for x, v in cnt.items()): print("Yes") else: print("NO")