結果

問題 No.854 公平なりんご分配
ユーザー 6soukiti296soukiti29
提出日時 2019-07-27 16:55:28
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,229 bytes
コンパイル時間 3,225 ms
コンパイル使用メモリ 69,804 KB
実行使用メモリ 16,920 KB
最終ジャッジ日時 2023-09-15 06:21:00
合計ジャッジ時間 8,732 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 4 ms
4,496 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
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 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 WA -
testcase_62 RE -
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 WA -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 RE -
testcase_83 RE -
testcase_84 RE -
testcase_85 RE -
testcase_86 RE -
testcase_87 RE -
testcase_88 RE -
testcase_89 RE -
testcase_90 RE -
testcase_91 RE -
testcase_92 RE -
testcase_93 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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..2005, 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:
    if a == 0:
        continue
    var k = a
    for j in primes:
        S[zip[j]][i] = S[zip[j]][i - 1]
        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