結果
問題 | No.854 公平なりんご分配 |
ユーザー | qib |
提出日時 | 2022-12-29 19:46:48 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,242 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 318,100 KB |
最終ジャッジ日時 | 2024-05-03 17:09:22 |
合計ジャッジ時間 | 46,818 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
64,928 KB |
testcase_01 | AC | 53 ms
66,588 KB |
testcase_02 | AC | 50 ms
65,916 KB |
testcase_03 | AC | 55 ms
65,748 KB |
testcase_04 | AC | 49 ms
64,932 KB |
testcase_05 | AC | 54 ms
66,832 KB |
testcase_06 | AC | 53 ms
65,452 KB |
testcase_07 | AC | 55 ms
65,260 KB |
testcase_08 | AC | 57 ms
65,976 KB |
testcase_09 | AC | 54 ms
66,856 KB |
testcase_10 | AC | 55 ms
65,460 KB |
testcase_11 | AC | 57 ms
65,968 KB |
testcase_12 | AC | 59 ms
67,040 KB |
testcase_13 | AC | 51 ms
66,640 KB |
testcase_14 | AC | 48 ms
64,448 KB |
testcase_15 | AC | 51 ms
66,956 KB |
testcase_16 | AC | 54 ms
66,636 KB |
testcase_17 | AC | 54 ms
66,152 KB |
testcase_18 | AC | 56 ms
66,300 KB |
testcase_19 | AC | 53 ms
66,244 KB |
testcase_20 | AC | 53 ms
66,248 KB |
testcase_21 | AC | 52 ms
66,620 KB |
testcase_22 | AC | 125 ms
78,972 KB |
testcase_23 | AC | 78 ms
75,220 KB |
testcase_24 | AC | 125 ms
79,944 KB |
testcase_25 | AC | 86 ms
78,540 KB |
testcase_26 | AC | 125 ms
80,360 KB |
testcase_27 | AC | 95 ms
79,540 KB |
testcase_28 | AC | 123 ms
78,296 KB |
testcase_29 | AC | 75 ms
71,736 KB |
testcase_30 | AC | 103 ms
78,656 KB |
testcase_31 | AC | 134 ms
79,432 KB |
testcase_32 | AC | 333 ms
129,836 KB |
testcase_33 | AC | 398 ms
105,396 KB |
testcase_34 | AC | 586 ms
149,764 KB |
testcase_35 | AC | 552 ms
133,888 KB |
testcase_36 | AC | 479 ms
82,232 KB |
testcase_37 | AC | 317 ms
126,332 KB |
testcase_38 | AC | 273 ms
117,040 KB |
testcase_39 | AC | 871 ms
154,088 KB |
testcase_40 | AC | 459 ms
101,356 KB |
testcase_41 | AC | 485 ms
122,684 KB |
testcase_42 | AC | 549 ms
148,708 KB |
testcase_43 | AC | 890 ms
124,620 KB |
testcase_44 | AC | 737 ms
142,484 KB |
testcase_45 | AC | 785 ms
90,804 KB |
testcase_46 | AC | 955 ms
141,684 KB |
testcase_47 | AC | 487 ms
114,060 KB |
testcase_48 | AC | 488 ms
147,172 KB |
testcase_49 | AC | 447 ms
148,504 KB |
testcase_50 | AC | 296 ms
125,772 KB |
testcase_51 | AC | 1,057 ms
144,776 KB |
testcase_52 | AC | 678 ms
107,132 KB |
testcase_53 | AC | 313 ms
106,464 KB |
testcase_54 | AC | 555 ms
112,520 KB |
testcase_55 | AC | 267 ms
106,548 KB |
testcase_56 | AC | 244 ms
107,792 KB |
testcase_57 | AC | 422 ms
103,644 KB |
testcase_58 | AC | 796 ms
89,440 KB |
testcase_59 | AC | 233 ms
99,916 KB |
testcase_60 | AC | 426 ms
102,160 KB |
testcase_61 | AC | 305 ms
83,620 KB |
testcase_62 | AC | 521 ms
99,344 KB |
testcase_63 | AC | 342 ms
99,692 KB |
testcase_64 | AC | 241 ms
86,840 KB |
testcase_65 | AC | 357 ms
139,180 KB |
testcase_66 | AC | 395 ms
94,020 KB |
testcase_67 | AC | 451 ms
117,264 KB |
testcase_68 | AC | 488 ms
94,564 KB |
testcase_69 | AC | 316 ms
153,776 KB |
testcase_70 | AC | 253 ms
101,840 KB |
testcase_71 | AC | 256 ms
103,852 KB |
testcase_72 | AC | 696 ms
82,164 KB |
testcase_73 | AC | 314 ms
127,200 KB |
testcase_74 | AC | 513 ms
137,524 KB |
testcase_75 | AC | 365 ms
104,316 KB |
testcase_76 | AC | 405 ms
124,584 KB |
testcase_77 | AC | 436 ms
146,224 KB |
testcase_78 | AC | 733 ms
98,152 KB |
testcase_79 | AC | 517 ms
118,060 KB |
testcase_80 | AC | 584 ms
121,704 KB |
testcase_81 | AC | 362 ms
122,856 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)] 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] s[0] = [0 for _ in range(n + 1)] for i in range(n): if a[i] == 0: s[0][i + 1] += 1 for x in range(m + 1): if x == 0 or dp[x] == x: for i in range(1, n + 1): s[x][i] += s[x][i - 1] q = int(input()) for i in range(q): p, l, r = map(int, input().split()) l -= 1 r -= 1 if p == 1 or s[0][r + 1] - s[0][l] > 0: 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")