結果
問題 | No.854 公平なりんご分配 |
ユーザー | Navier_Boltzmann |
提出日時 | 2022-04-10 16:33:49 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,614 bytes |
コンパイル時間 | 549 ms |
コンパイル使用メモリ | 10,764 KB |
実行使用メモリ | 443,468 KB |
最終ジャッジ日時 | 2023-08-20 22:01:24 |
合計ジャッジ時間 | 21,842 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 20 ms
13,124 KB |
testcase_01 | AC | 21 ms
8,816 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 20 ms
8,688 KB |
testcase_05 | AC | 20 ms
8,620 KB |
testcase_06 | AC | 21 ms
8,728 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 20 ms
8,728 KB |
testcase_10 | AC | 20 ms
8,784 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 20 ms
8,688 KB |
testcase_15 | AC | 20 ms
8,780 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 20 ms
8,624 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | MLE | - |
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 | -- | - |
ソースコード
N = int(input()) A = list(map(int,input().split())) Q = int(input()) from collections import defaultdict,Counter d = defaultdict(lambda:[0]*N) class prime_factorize(): def __init__(self,M=10**6): self.sieve = [-1]*(M+1) self.sieve[1] = 1 self.p = [False]*(M+1) for i in range(2,M+1): if self.sieve[i] == -1: self.p[i] = True for j in range(i,M+1,i): self.sieve[j] = i def factors(self,x): tmp = [] while self.sieve[x] != x: tmp.append(self.sieve[x]) x //= self.sieve[x] tmp.append(self.sieve[x]) return tmp def is_prime(self,x): return self.p[x] p = prime_factorize(M=2001) for i in range(N): a = A[i] for k,v in Counter(p.factors(a)).items(): d[k][i] += v if i!=0: d[k][i] += d[k][i-1] p_list = [] for i in range(1,2001): if p.is_prime(i): p_list.append(i) for _ in range(Q): P,L,R = map(int,input().split()) L -= 1 R -= 1 dp = defaultdict(lambda:0) c_flg = True while P != 1 and c_flg: flg = True for i in p_list: if P%i==0: dp[i] += 1 P //= i flg = False break if flg: print('NO') c_flg = False if not c_flg: continue if all(d[k][R]-d[k][L-1] >= dp[k] for k in dp.keys()): print('Yes') else: print('NO') continue