結果

問題 No.854 公平なりんご分配
ユーザー 6soukiti296soukiti29
提出日時 2019-07-27 18:44:22
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,143 bytes
コンパイル時間 4,899 ms
コンパイル使用メモリ 69,704 KB
実行使用メモリ 250,824 KB
最終ジャッジ日時 2023-09-15 06:30:45
合計ジャッジ時間 51,281 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 4 ms
4,384 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 5 ms
4,416 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 4 ms
4,384 KB
testcase_06 AC 4 ms
4,384 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 5 ms
4,420 KB
testcase_12 AC 5 ms
4,472 KB
testcase_13 AC 5 ms
4,460 KB
testcase_14 AC 4 ms
4,396 KB
testcase_15 AC 4 ms
4,424 KB
testcase_16 AC 5 ms
4,508 KB
testcase_17 AC 5 ms
4,504 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 AC 4 ms
4,432 KB
testcase_20 AC 4 ms
4,504 KB
testcase_21 AC 5 ms
4,384 KB
testcase_22 AC 11 ms
4,808 KB
testcase_23 AC 11 ms
5,812 KB
testcase_24 AC 18 ms
6,596 KB
testcase_25 AC 10 ms
5,404 KB
testcase_26 AC 19 ms
6,668 KB
testcase_27 AC 15 ms
6,672 KB
testcase_28 AC 11 ms
4,936 KB
testcase_29 AC 7 ms
4,880 KB
testcase_30 AC 10 ms
5,264 KB
testcase_31 AC 17 ms
6,308 KB
testcase_32 AC 222 ms
56,492 KB
testcase_33 AC 253 ms
32,220 KB
testcase_34 AC 474 ms
76,124 KB
testcase_35 AC 324 ms
60,704 KB
testcase_36 AC 131 ms
7,600 KB
testcase_37 AC 214 ms
53,332 KB
testcase_38 AC 166 ms
44,000 KB
testcase_39 AC 722 ms
80,664 KB
testcase_40 AC 271 ms
28,064 KB
testcase_41 AC 319 ms
49,708 KB
testcase_42 AC 409 ms
75,056 KB
testcase_43 AC 495 ms
51,744 KB
testcase_44 AC 535 ms
69,880 KB
testcase_45 AC 420 ms
16,744 KB
testcase_46 AC 683 ms
68,776 KB
testcase_47 AC 249 ms
39,876 KB
testcase_48 AC 377 ms
74,024 KB
testcase_49 AC 352 ms
75,396 KB
testcase_50 AC 196 ms
52,932 KB
testcase_51 AC 678 ms
72,160 KB
testcase_52 AC 535 ms
33,772 KB
testcase_53 AC 315 ms
33,212 KB
testcase_54 AC 560 ms
39,008 KB
testcase_55 AC 193 ms
33,468 KB
testcase_56 AC 157 ms
34,712 KB
testcase_57 AC 254 ms
28,888 KB
testcase_58 AC 380 ms
14,116 KB
testcase_59 AC 135 ms
25,660 KB
testcase_60 AC 362 ms
28,908 KB
testcase_61 AC 120 ms
8,852 KB
testcase_62 AC 399 ms
25,060 KB
testcase_63 AC 367 ms
26,276 KB
testcase_64 AC 96 ms
12,524 KB
testcase_65 AC 309 ms
66,144 KB
testcase_66 AC 227 ms
19,796 KB
testcase_67 AC 459 ms
43,632 KB
testcase_68 AC 436 ms
21,036 KB
testcase_69 AC 281 ms
80,880 KB
testcase_70 AC 168 ms
28,376 KB
testcase_71 AC 202 ms
30,720 KB
testcase_72 AC 182 ms
7,756 KB
testcase_73 AC 275 ms
53,820 KB
testcase_74 AC 595 ms
64,932 KB
testcase_75 AC 271 ms
30,852 KB
testcase_76 AC 511 ms
51,456 KB
testcase_77 AC 502 ms
73,576 KB
testcase_78 AC 484 ms
22,856 KB
testcase_79 AC 553 ms
45,220 KB
testcase_80 AC 512 ms
47,652 KB
testcase_81 AC 407 ms
49,412 KB
testcase_82 AC 1,490 ms
250,772 KB
testcase_83 AC 1,533 ms
250,624 KB
testcase_84 AC 1,502 ms
250,824 KB
testcase_85 AC 1,567 ms
250,664 KB
testcase_86 AC 1,133 ms
250,760 KB
testcase_87 AC 2,593 ms
250,808 KB
testcase_88 AC 2,630 ms
250,760 KB
testcase_89 AC 2,610 ms
250,672 KB
testcase_90 AC 2,502 ms
250,644 KB
testcase_91 AC 2,506 ms
250,664 KB
testcase_92 WA -
testcase_93 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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] >= 30:
        f = true
    if f:
        echo "Yes"
    else:
        echo "NO"
0