結果
問題 | No.854 公平なりんご分配 |
ユーザー | maspy |
提出日時 | 2020-03-18 15:13:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,419 ms / 3,153 ms |
コード長 | 1,240 bytes |
コンパイル時間 | 308 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 122,512 KB |
最終ジャッジ日時 | 2024-12-14 02:06:07 |
合計ジャッジ時間 | 45,017 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
59,404 KB |
testcase_01 | AC | 47 ms
61,080 KB |
testcase_02 | AC | 46 ms
60,612 KB |
testcase_03 | AC | 47 ms
60,836 KB |
testcase_04 | AC | 44 ms
60,188 KB |
testcase_05 | AC | 46 ms
60,972 KB |
testcase_06 | AC | 45 ms
60,644 KB |
testcase_07 | AC | 46 ms
61,260 KB |
testcase_08 | AC | 47 ms
61,516 KB |
testcase_09 | AC | 47 ms
61,320 KB |
testcase_10 | AC | 49 ms
62,940 KB |
testcase_11 | AC | 46 ms
61,288 KB |
testcase_12 | AC | 49 ms
63,164 KB |
testcase_13 | AC | 49 ms
62,676 KB |
testcase_14 | AC | 45 ms
60,468 KB |
testcase_15 | AC | 47 ms
62,468 KB |
testcase_16 | AC | 51 ms
63,956 KB |
testcase_17 | AC | 47 ms
62,868 KB |
testcase_18 | AC | 48 ms
61,384 KB |
testcase_19 | AC | 48 ms
61,656 KB |
testcase_20 | AC | 47 ms
62,316 KB |
testcase_21 | AC | 47 ms
62,728 KB |
testcase_22 | AC | 65 ms
72,132 KB |
testcase_23 | AC | 59 ms
64,812 KB |
testcase_24 | AC | 73 ms
70,232 KB |
testcase_25 | AC | 57 ms
64,232 KB |
testcase_26 | AC | 67 ms
67,380 KB |
testcase_27 | AC | 63 ms
65,416 KB |
testcase_28 | AC | 61 ms
67,712 KB |
testcase_29 | AC | 55 ms
66,364 KB |
testcase_30 | AC | 57 ms
63,900 KB |
testcase_31 | AC | 73 ms
74,196 KB |
testcase_32 | AC | 254 ms
77,460 KB |
testcase_33 | AC | 276 ms
79,428 KB |
testcase_34 | AC | 461 ms
83,640 KB |
testcase_35 | AC | 329 ms
79,888 KB |
testcase_36 | AC | 233 ms
80,196 KB |
testcase_37 | AC | 217 ms
77,800 KB |
testcase_38 | AC | 221 ms
77,032 KB |
testcase_39 | AC | 640 ms
88,772 KB |
testcase_40 | AC | 283 ms
80,032 KB |
testcase_41 | AC | 311 ms
80,208 KB |
testcase_42 | AC | 428 ms
81,456 KB |
testcase_43 | AC | 486 ms
85,604 KB |
testcase_44 | AC | 393 ms
85,744 KB |
testcase_45 | AC | 473 ms
87,892 KB |
testcase_46 | AC | 591 ms
88,444 KB |
testcase_47 | AC | 285 ms
78,176 KB |
testcase_48 | AC | 413 ms
80,864 KB |
testcase_49 | AC | 353 ms
79,412 KB |
testcase_50 | AC | 242 ms
77,220 KB |
testcase_51 | AC | 500 ms
88,620 KB |
testcase_52 | AC | 522 ms
87,904 KB |
testcase_53 | AC | 263 ms
80,292 KB |
testcase_54 | AC | 451 ms
87,124 KB |
testcase_55 | AC | 218 ms
77,056 KB |
testcase_56 | AC | 186 ms
76,736 KB |
testcase_57 | AC | 270 ms
79,772 KB |
testcase_58 | AC | 466 ms
87,916 KB |
testcase_59 | AC | 188 ms
77,184 KB |
testcase_60 | AC | 298 ms
84,856 KB |
testcase_61 | AC | 196 ms
79,748 KB |
testcase_62 | AC | 385 ms
85,084 KB |
testcase_63 | AC | 380 ms
84,284 KB |
testcase_64 | AC | 159 ms
77,156 KB |
testcase_65 | AC | 350 ms
79,076 KB |
testcase_66 | AC | 265 ms
80,328 KB |
testcase_67 | AC | 409 ms
84,728 KB |
testcase_68 | AC | 370 ms
87,184 KB |
testcase_69 | AC | 308 ms
79,416 KB |
testcase_70 | AC | 198 ms
77,360 KB |
testcase_71 | AC | 217 ms
78,104 KB |
testcase_72 | AC | 310 ms
85,180 KB |
testcase_73 | AC | 244 ms
78,504 KB |
testcase_74 | AC | 435 ms
86,572 KB |
testcase_75 | AC | 285 ms
80,132 KB |
testcase_76 | AC | 431 ms
85,296 KB |
testcase_77 | AC | 491 ms
85,772 KB |
testcase_78 | AC | 482 ms
88,012 KB |
testcase_79 | AC | 488 ms
86,788 KB |
testcase_80 | AC | 415 ms
85,620 KB |
testcase_81 | AC | 324 ms
82,832 KB |
testcase_82 | AC | 1,772 ms
122,512 KB |
testcase_83 | AC | 1,854 ms
122,192 KB |
testcase_84 | AC | 1,532 ms
122,164 KB |
testcase_85 | AC | 2,029 ms
122,320 KB |
testcase_86 | AC | 1,053 ms
121,284 KB |
testcase_87 | AC | 2,419 ms
121,724 KB |
testcase_88 | AC | 1,590 ms
121,824 KB |
testcase_89 | AC | 1,887 ms
121,752 KB |
testcase_90 | AC | 2,033 ms
121,928 KB |
testcase_91 | AC | 1,882 ms
121,684 KB |
testcase_92 | AC | 1,704 ms
121,772 KB |
testcase_93 | AC | 2,265 ms
121,824 KB |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines INF = 100 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 ord_A = [0] * (N + 1) def solve(p): for i in range(N): e = 0 if A[i]: while A[i] % p == 0: A[i] //= p e += 1 ord_A[i + 1] = ord_A[i] + e for i in range(Q): e = 0 while P[i] % p == 0: P[i] //= p e += 1 f = ord_A[R[i]] - ord_A[L[i] - 1] if f < e: ok[i] = 0 for p in range(U): if is_prime[p]: solve(p) zero_cnt = [0] * (N + 1) for i, x in enumerate(A): zero_cnt[i + 1] = zero_cnt[i] + (x == 0) for i in range(Q): if P[i] > 1: ok[i] = 0 if zero_cnt[R[i]] - zero_cnt[L[i] - 1]: ok[i] = 1 answers = ('Yes' if x else 'NO' for x in ok) print('\n'.join(answers))