結果
問題 | No.854 公平なりんご分配 |
ユーザー | qib |
提出日時 | 2022-12-29 19:46:48 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,242 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 318,500 KB |
最終ジャッジ日時 | 2024-11-24 20:05:29 |
合計ジャッジ時間 | 49,044 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
64,128 KB |
testcase_01 | AC | 49 ms
65,664 KB |
testcase_02 | AC | 46 ms
64,128 KB |
testcase_03 | AC | 49 ms
65,408 KB |
testcase_04 | AC | 47 ms
64,128 KB |
testcase_05 | AC | 49 ms
65,536 KB |
testcase_06 | AC | 47 ms
65,024 KB |
testcase_07 | AC | 47 ms
64,896 KB |
testcase_08 | AC | 48 ms
65,024 KB |
testcase_09 | AC | 47 ms
64,768 KB |
testcase_10 | AC | 49 ms
65,408 KB |
testcase_11 | AC | 50 ms
65,664 KB |
testcase_12 | AC | 54 ms
65,792 KB |
testcase_13 | AC | 53 ms
66,176 KB |
testcase_14 | AC | 48 ms
64,384 KB |
testcase_15 | AC | 54 ms
66,048 KB |
testcase_16 | AC | 52 ms
65,792 KB |
testcase_17 | AC | 52 ms
66,048 KB |
testcase_18 | AC | 49 ms
66,048 KB |
testcase_19 | AC | 49 ms
66,176 KB |
testcase_20 | AC | 50 ms
65,792 KB |
testcase_21 | AC | 50 ms
65,664 KB |
testcase_22 | AC | 131 ms
79,052 KB |
testcase_23 | AC | 82 ms
75,016 KB |
testcase_24 | AC | 130 ms
79,616 KB |
testcase_25 | AC | 83 ms
78,592 KB |
testcase_26 | AC | 139 ms
80,424 KB |
testcase_27 | AC | 96 ms
79,360 KB |
testcase_28 | AC | 130 ms
78,552 KB |
testcase_29 | AC | 71 ms
70,656 KB |
testcase_30 | AC | 97 ms
78,592 KB |
testcase_31 | AC | 113 ms
79,380 KB |
testcase_32 | AC | 318 ms
129,604 KB |
testcase_33 | AC | 387 ms
105,216 KB |
testcase_34 | AC | 590 ms
149,180 KB |
testcase_35 | AC | 523 ms
133,572 KB |
testcase_36 | AC | 450 ms
81,848 KB |
testcase_37 | AC | 315 ms
126,088 KB |
testcase_38 | AC | 272 ms
116,876 KB |
testcase_39 | AC | 897 ms
153,920 KB |
testcase_40 | AC | 463 ms
101,368 KB |
testcase_41 | AC | 480 ms
122,796 KB |
testcase_42 | AC | 537 ms
148,284 KB |
testcase_43 | AC | 900 ms
124,408 KB |
testcase_44 | AC | 720 ms
142,532 KB |
testcase_45 | AC | 783 ms
90,672 KB |
testcase_46 | AC | 943 ms
141,692 KB |
testcase_47 | AC | 469 ms
113,516 KB |
testcase_48 | AC | 502 ms
146,896 KB |
testcase_49 | AC | 448 ms
148,616 KB |
testcase_50 | AC | 291 ms
125,640 KB |
testcase_51 | AC | 1,057 ms
145,100 KB |
testcase_52 | AC | 671 ms
106,752 KB |
testcase_53 | AC | 346 ms
106,384 KB |
testcase_54 | AC | 572 ms
112,772 KB |
testcase_55 | AC | 266 ms
106,740 KB |
testcase_56 | AC | 246 ms
107,520 KB |
testcase_57 | AC | 417 ms
103,016 KB |
testcase_58 | AC | 826 ms
89,308 KB |
testcase_59 | AC | 238 ms
99,528 KB |
testcase_60 | AC | 416 ms
102,400 KB |
testcase_61 | AC | 304 ms
83,288 KB |
testcase_62 | AC | 528 ms
99,984 KB |
testcase_63 | AC | 362 ms
99,500 KB |
testcase_64 | AC | 241 ms
86,588 KB |
testcase_65 | AC | 350 ms
139,092 KB |
testcase_66 | AC | 409 ms
94,004 KB |
testcase_67 | AC | 445 ms
116,864 KB |
testcase_68 | AC | 468 ms
94,976 KB |
testcase_69 | AC | 319 ms
153,752 KB |
testcase_70 | AC | 257 ms
101,504 KB |
testcase_71 | AC | 244 ms
103,552 KB |
testcase_72 | AC | 731 ms
82,600 KB |
testcase_73 | AC | 289 ms
126,856 KB |
testcase_74 | AC | 512 ms
137,556 KB |
testcase_75 | AC | 370 ms
103,912 KB |
testcase_76 | AC | 412 ms
124,304 KB |
testcase_77 | AC | 473 ms
146,148 KB |
testcase_78 | AC | 750 ms
98,024 KB |
testcase_79 | AC | 522 ms
118,016 KB |
testcase_80 | AC | 606 ms
121,196 KB |
testcase_81 | AC | 360 ms
122,604 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")