結果

問題 No.854 公平なりんご分配
ユーザー 6soukiti296soukiti29
提出日時 2019-07-27 18:53:47
言語 Nim
(2.0.0)
結果
AC  
実行時間 2,576 ms / 3,153 ms
コード長 1,144 bytes
コンパイル時間 3,473 ms
コンパイル使用メモリ 69,800 KB
実行使用メモリ 250,836 KB
最終ジャッジ日時 2023-09-15 06:32:07
合計ジャッジ時間 50,934 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 4 ms
4,384 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 5 ms
4,404 KB
testcase_04 AC 4 ms
4,384 KB
testcase_05 AC 4 ms
4,384 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 4 ms
4,384 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 4 ms
4,412 KB
testcase_10 AC 4 ms
4,384 KB
testcase_11 AC 4 ms
4,420 KB
testcase_12 AC 5 ms
4,488 KB
testcase_13 AC 5 ms
4,460 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 5 ms
4,424 KB
testcase_17 AC 5 ms
4,500 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 5 ms
4,404 KB
testcase_21 AC 5 ms
4,424 KB
testcase_22 AC 11 ms
4,848 KB
testcase_23 AC 11 ms
5,664 KB
testcase_24 AC 17 ms
6,568 KB
testcase_25 AC 10 ms
5,392 KB
testcase_26 AC 18 ms
6,676 KB
testcase_27 AC 15 ms
6,700 KB
testcase_28 AC 11 ms
4,844 KB
testcase_29 AC 7 ms
4,888 KB
testcase_30 AC 11 ms
5,412 KB
testcase_31 AC 18 ms
6,332 KB
testcase_32 AC 228 ms
56,432 KB
testcase_33 AC 268 ms
32,124 KB
testcase_34 AC 480 ms
76,108 KB
testcase_35 AC 329 ms
60,680 KB
testcase_36 AC 133 ms
7,688 KB
testcase_37 AC 216 ms
53,148 KB
testcase_38 AC 177 ms
43,836 KB
testcase_39 AC 733 ms
80,508 KB
testcase_40 AC 283 ms
28,068 KB
testcase_41 AC 324 ms
49,816 KB
testcase_42 AC 414 ms
74,952 KB
testcase_43 AC 519 ms
51,604 KB
testcase_44 AC 536 ms
69,700 KB
testcase_45 AC 419 ms
16,760 KB
testcase_46 AC 687 ms
68,640 KB
testcase_47 AC 247 ms
39,880 KB
testcase_48 AC 377 ms
73,884 KB
testcase_49 AC 351 ms
75,524 KB
testcase_50 AC 197 ms
53,080 KB
testcase_51 AC 700 ms
72,088 KB
testcase_52 AC 548 ms
33,736 KB
testcase_53 AC 312 ms
33,164 KB
testcase_54 AC 559 ms
38,992 KB
testcase_55 AC 201 ms
33,392 KB
testcase_56 AC 159 ms
34,700 KB
testcase_57 AC 257 ms
28,828 KB
testcase_58 AC 396 ms
14,264 KB
testcase_59 AC 139 ms
25,812 KB
testcase_60 AC 372 ms
28,844 KB
testcase_61 AC 122 ms
8,720 KB
testcase_62 AC 403 ms
25,036 KB
testcase_63 AC 375 ms
26,440 KB
testcase_64 AC 95 ms
12,496 KB
testcase_65 AC 311 ms
66,124 KB
testcase_66 AC 233 ms
19,632 KB
testcase_67 AC 465 ms
43,788 KB
testcase_68 AC 463 ms
20,912 KB
testcase_69 AC 281 ms
80,820 KB
testcase_70 AC 167 ms
28,520 KB
testcase_71 AC 202 ms
30,700 KB
testcase_72 AC 181 ms
7,720 KB
testcase_73 AC 276 ms
53,816 KB
testcase_74 AC 604 ms
64,952 KB
testcase_75 AC 280 ms
30,892 KB
testcase_76 AC 521 ms
51,456 KB
testcase_77 AC 510 ms
73,564 KB
testcase_78 AC 496 ms
23,028 KB
testcase_79 AC 568 ms
45,032 KB
testcase_80 AC 528 ms
47,800 KB
testcase_81 AC 415 ms
49,464 KB
testcase_82 AC 1,501 ms
250,692 KB
testcase_83 AC 1,503 ms
250,772 KB
testcase_84 AC 1,499 ms
250,616 KB
testcase_85 AC 1,598 ms
250,644 KB
testcase_86 AC 1,138 ms
250,748 KB
testcase_87 AC 2,576 ms
250,760 KB
testcase_88 AC 2,482 ms
250,836 KB
testcase_89 AC 2,462 ms
250,772 KB
testcase_90 AC 2,518 ms
250,644 KB
testcase_91 AC 2,487 ms
250,820 KB
testcase_92 AC 2,496 ms
250,676 KB
testcase_93 AC 2,502 ms
250,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 31) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,math,algorithm
var
    N = stdin.readline.parseInt
    A = stdin.readline.split.map(parseInt)
    primes = newSeq[int](0)
    isnotprime : array[2005, bool]
    S : array[350, array[-1..100005, int]]

for i in 2..2000:
    if isnotprime[i]:
        continue
    var j = i * 2
    while j <= 2000:
        isnotprime[j] = true
        j += i
    primes.add(i)
    
var
    Q = stdin.readline.parseInt
    P,L,R : int

for i,a in A:
    var k = a
    for j,p in primes:
        S[j][i] = S[j][i - 1]
        if a == 0:
            S[j][i] += 300
            continue
        while k mod p == 0:
            S[j][i] += 1
            k = k div p
    

for q in 0..<Q:
    (P, L, R) = stdin.readline.split.map(parseInt)
    L -= 2
    R -= 1
    var f : bool = true
    var s : array[304, int]
    for j in 0..303:
        s[j] = S[j][R] - S[j][L]
    for i,p in primes:
        while P mod p == 0:
            P = P div p
            s[i] -= 1
            if s[i] < 0:
                f = false
    if P > 1:
        f = false
    if s[300] >= 300:
        f = true
    if f:
        echo "Yes"
    else:
        echo "NO"
0