結果
問題 | No.854 公平なりんご分配 |
ユーザー | maspy |
提出日時 | 2020-03-18 14:03:41 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,142 bytes |
コンパイル時間 | 1,525 ms |
コンパイル使用メモリ | 86,544 KB |
実行使用メモリ | 148,440 KB |
最終ジャッジ日時 | 2023-08-20 19:53:43 |
合計ジャッジ時間 | 24,814 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
80,100 KB |
testcase_01 | AC | 97 ms
75,904 KB |
testcase_02 | AC | 92 ms
76,304 KB |
testcase_03 | AC | 98 ms
75,936 KB |
testcase_04 | AC | 94 ms
76,624 KB |
testcase_05 | AC | 97 ms
75,940 KB |
testcase_06 | AC | 94 ms
75,960 KB |
testcase_07 | AC | 96 ms
75,972 KB |
testcase_08 | AC | 98 ms
76,592 KB |
testcase_09 | AC | 97 ms
76,488 KB |
testcase_10 | AC | 100 ms
76,584 KB |
testcase_11 | AC | 98 ms
75,980 KB |
testcase_12 | AC | 104 ms
76,600 KB |
testcase_13 | AC | 101 ms
76,664 KB |
testcase_14 | AC | 99 ms
76,560 KB |
testcase_15 | AC | 102 ms
76,752 KB |
testcase_16 | AC | 101 ms
76,432 KB |
testcase_17 | AC | 103 ms
76,672 KB |
testcase_18 | AC | 97 ms
76,492 KB |
testcase_19 | AC | 102 ms
76,484 KB |
testcase_20 | AC | 97 ms
76,316 KB |
testcase_21 | AC | 97 ms
76,364 KB |
testcase_22 | AC | 120 ms
77,144 KB |
testcase_23 | AC | 116 ms
77,136 KB |
testcase_24 | AC | 134 ms
77,420 KB |
testcase_25 | AC | 115 ms
77,088 KB |
testcase_26 | AC | 129 ms
77,352 KB |
testcase_27 | AC | 126 ms
77,348 KB |
testcase_28 | AC | 116 ms
77,168 KB |
testcase_29 | AC | 107 ms
76,540 KB |
testcase_30 | AC | 114 ms
77,252 KB |
testcase_31 | AC | 131 ms
77,212 KB |
testcase_32 | AC | 542 ms
109,068 KB |
testcase_33 | AC | 454 ms
87,208 KB |
testcase_34 | AC | 846 ms
133,380 KB |
testcase_35 | AC | 677 ms
118,444 KB |
testcase_36 | AC | 306 ms
81,408 KB |
testcase_37 | AC | 497 ms
109,312 KB |
testcase_38 | AC | 428 ms
94,536 KB |
testcase_39 | AC | 1,065 ms
148,440 KB |
testcase_40 | AC | 455 ms
88,212 KB |
testcase_41 | AC | 570 ms
106,644 KB |
testcase_42 | AC | 769 ms
130,188 KB |
testcase_43 | AC | 738 ms
116,856 KB |
testcase_44 | AC | 733 ms
134,240 KB |
testcase_45 | AC | 576 ms
99,632 KB |
testcase_46 | AC | 1,000 ms
136,008 KB |
testcase_47 | AC | 453 ms
93,116 KB |
testcase_48 | AC | 741 ms
126,952 KB |
testcase_49 | AC | 703 ms
130,544 KB |
testcase_50 | AC | 492 ms
104,252 KB |
testcase_51 | AC | 826 ms
139,916 KB |
testcase_52 | TLE | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools N = int(readline()) A = list(map(int, readline().split())) Q = int(readline()) m = map(int, read().split()) P, L, R = zip(*zip(m, m, m)) P = list(P) U = 2010 is_prime = [1] * U is_prime[0] = 0 is_prime[1] = 0 for p in range(2, U): if p * p >= U: break for i in range(p * p, U, p): is_prime[i] = 0 ok = [1] * Q def solve(p): ord_A = [0] * N ord_P = [0] * Q for i in range(N): while A[i] % p == 0: A[i] //= p ord_A[i] += 1 for i in range(Q): while P[i] % p == 0: P[i] //= p ord_P[i] += 1 ord_A_cum = [0] * (N + 1) ord_A_cum[1:] = itertools.accumulate(ord_A) for i in range(Q): e = ord_A_cum[R[i]] - ord_A_cum[L[i] - 1] if e < ord_P[i]: ok[i] = 0 for p in range(U): if is_prime[p]: solve(p) for i in range(Q): if P[i] > 1: ok[i] = 0 answers = ('Yes' if x else 'NO' for x in ok) print('\n'.join(answers))