結果

問題 No.854 公平なりんご分配
ユーザー 6soukiti296soukiti29
提出日時 2019-07-27 17:19:25
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,271 bytes
コンパイル時間 3,428 ms
コンパイル使用メモリ 69,612 KB
実行使用メモリ 252,204 KB
最終ジャッジ日時 2023-09-15 06:24:55
合計ジャッジ時間 55,610 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 4 ms
4,432 KB
testcase_03 AC 4 ms
4,384 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 4 ms
4,440 KB
testcase_07 AC 4 ms
4,436 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 4 ms
4,388 KB
testcase_11 AC 4 ms
4,384 KB
testcase_12 AC 5 ms
4,504 KB
testcase_13 AC 5 ms
4,456 KB
testcase_14 AC 4 ms
4,384 KB
testcase_15 AC 5 ms
4,388 KB
testcase_16 AC 5 ms
4,444 KB
testcase_17 AC 5 ms
4,488 KB
testcase_18 AC 5 ms
4,428 KB
testcase_19 AC 4 ms
4,452 KB
testcase_20 AC 4 ms
4,384 KB
testcase_21 AC 4 ms
4,412 KB
testcase_22 AC 12 ms
5,024 KB
testcase_23 AC 12 ms
5,880 KB
testcase_24 AC 19 ms
6,756 KB
testcase_25 AC 10 ms
5,572 KB
testcase_26 AC 20 ms
6,640 KB
testcase_27 AC 16 ms
6,760 KB
testcase_28 AC 11 ms
4,852 KB
testcase_29 AC 7 ms
4,904 KB
testcase_30 AC 11 ms
5,352 KB
testcase_31 AC 18 ms
6,320 KB
testcase_32 AC 236 ms
56,488 KB
testcase_33 AC 273 ms
32,152 KB
testcase_34 AC 501 ms
76,164 KB
testcase_35 AC 345 ms
60,676 KB
testcase_36 AC 143 ms
7,716 KB
testcase_37 AC 230 ms
53,212 KB
testcase_38 AC 178 ms
43,884 KB
testcase_39 AC 775 ms
80,736 KB
testcase_40 AC 309 ms
28,080 KB
testcase_41 AC 351 ms
49,880 KB
testcase_42 AC 438 ms
75,000 KB
testcase_43 AC 525 ms
51,640 KB
testcase_44 AC 555 ms
69,864 KB
testcase_45 AC 476 ms
16,780 KB
testcase_46 AC 719 ms
68,672 KB
testcase_47 AC 257 ms
39,996 KB
testcase_48 AC 398 ms
73,872 KB
testcase_49 AC 370 ms
75,416 KB
testcase_50 AC 209 ms
53,108 KB
testcase_51 AC 724 ms
72,148 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 AC 1,614 ms
250,636 KB
testcase_84 AC 1,606 ms
250,708 KB
testcase_85 AC 1,664 ms
250,792 KB
testcase_86 AC 1,318 ms
250,772 KB
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 2,915 ms
250,660 KB
testcase_93 AC 2,810 ms
250,668 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
    zip : array[2005, int]
    unzip:array[304, int]
    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)
    
#echo primes.len(),primes
for i,p in primes:
    zip[p] = i
    unzip[i] = p
    
var
    Q = stdin.readline.parseInt
    P,L,R : int

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

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 p in primes:
        while P mod p == 0:
            P = P div p
            s[zip[p]] -= 1
            if s[zip[p]] < 0:
                f = false
    if P > 1:
        f = false
    if f:
        echo "Yes"
    else:
        echo "NO"
    
0