結果

問題 No.854 公平なりんご分配
ユーザー 6soukiti296soukiti29
提出日時 2019-07-27 17:18:24
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 1,270 bytes
コンパイル時間 3,392 ms
コンパイル使用メモリ 69,704 KB
実行使用メモリ 36,352 KB
最終ジャッジ日時 2023-09-15 06:22:20
合計ジャッジ時間 16,285 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,388 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,432 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 3 ms
4,436 KB
testcase_11 AC 4 ms
4,384 KB
testcase_12 AC 4 ms
4,628 KB
testcase_13 AC 4 ms
4,424 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 4 ms
4,556 KB
testcase_17 AC 4 ms
4,696 KB
testcase_18 AC 4 ms
4,380 KB
testcase_19 AC 4 ms
4,456 KB
testcase_20 AC 3 ms
4,408 KB
testcase_21 AC 4 ms
4,508 KB
testcase_22 AC 11 ms
4,824 KB
testcase_23 AC 11 ms
5,684 KB
testcase_24 AC 18 ms
6,540 KB
testcase_25 AC 9 ms
5,432 KB
testcase_26 AC 19 ms
6,640 KB
testcase_27 AC 15 ms
6,712 KB
testcase_28 AC 10 ms
4,992 KB
testcase_29 AC 6 ms
4,908 KB
testcase_30 AC 9 ms
5,292 KB
testcase_31 AC 18 ms
6,296 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 141 ms
7,712 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 304 ms
27,724 KB
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 493 ms
16,820 KB
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 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 RE -
testcase_66 WA -
testcase_67 RE -
testcase_68 WA -
testcase_69 RE -
testcase_70 WA -
testcase_71 RE -
testcase_72 WA -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 WA -
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..10005, 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