結果
問題 | No.854 公平なりんご分配 |
ユーザー | pekempey |
提出日時 | 2019-08-01 19:19:43 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 959 ms / 3,153 ms |
コード長 | 1,481 bytes |
コンパイル時間 | 7,567 ms |
コンパイル使用メモリ | 187,532 KB |
実行使用メモリ | 65,720 KB |
最終ジャッジ日時 | 2024-07-05 07:51:53 |
合計ジャッジ時間 | 36,864 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
31,488 KB |
testcase_01 | AC | 73 ms
31,360 KB |
testcase_02 | AC | 74 ms
31,360 KB |
testcase_03 | AC | 73 ms
31,616 KB |
testcase_04 | AC | 73 ms
31,616 KB |
testcase_05 | AC | 72 ms
31,616 KB |
testcase_06 | AC | 74 ms
31,360 KB |
testcase_07 | AC | 75 ms
31,616 KB |
testcase_08 | AC | 74 ms
31,488 KB |
testcase_09 | AC | 79 ms
31,616 KB |
testcase_10 | AC | 76 ms
31,744 KB |
testcase_11 | AC | 75 ms
31,488 KB |
testcase_12 | AC | 79 ms
32,640 KB |
testcase_13 | AC | 79 ms
32,640 KB |
testcase_14 | AC | 75 ms
31,616 KB |
testcase_15 | AC | 77 ms
31,616 KB |
testcase_16 | AC | 82 ms
32,896 KB |
testcase_17 | AC | 81 ms
32,640 KB |
testcase_18 | AC | 78 ms
32,640 KB |
testcase_19 | AC | 79 ms
32,512 KB |
testcase_20 | AC | 82 ms
32,640 KB |
testcase_21 | AC | 80 ms
32,640 KB |
testcase_22 | AC | 84 ms
33,152 KB |
testcase_23 | AC | 82 ms
33,408 KB |
testcase_24 | AC | 86 ms
34,304 KB |
testcase_25 | AC | 81 ms
33,152 KB |
testcase_26 | AC | 87 ms
34,156 KB |
testcase_27 | AC | 82 ms
33,792 KB |
testcase_28 | AC | 84 ms
33,152 KB |
testcase_29 | AC | 80 ms
32,768 KB |
testcase_30 | AC | 82 ms
33,152 KB |
testcase_31 | AC | 93 ms
34,048 KB |
testcase_32 | AC | 155 ms
55,936 KB |
testcase_33 | AC | 179 ms
54,400 KB |
testcase_34 | AC | 253 ms
45,020 KB |
testcase_35 | AC | 196 ms
41,220 KB |
testcase_36 | AC | 181 ms
43,904 KB |
testcase_37 | AC | 152 ms
55,908 KB |
testcase_38 | AC | 135 ms
54,912 KB |
testcase_39 | AC | 358 ms
52,604 KB |
testcase_40 | AC | 216 ms
54,144 KB |
testcase_41 | AC | 197 ms
55,936 KB |
testcase_42 | AC | 225 ms
43,256 KB |
testcase_43 | AC | 271 ms
56,300 KB |
testcase_44 | AC | 278 ms
47,144 KB |
testcase_45 | AC | 305 ms
56,192 KB |
testcase_46 | AC | 353 ms
52,072 KB |
testcase_47 | AC | 185 ms
56,060 KB |
testcase_48 | AC | 206 ms
42,156 KB |
testcase_49 | AC | 199 ms
41,452 KB |
testcase_50 | AC | 143 ms
55,936 KB |
testcase_51 | AC | 340 ms
51,828 KB |
testcase_52 | AC | 304 ms
56,064 KB |
testcase_53 | AC | 200 ms
56,064 KB |
testcase_54 | AC | 298 ms
56,192 KB |
testcase_55 | AC | 153 ms
52,352 KB |
testcase_56 | AC | 144 ms
51,456 KB |
testcase_57 | AC | 188 ms
53,220 KB |
testcase_58 | AC | 306 ms
56,064 KB |
testcase_59 | AC | 138 ms
46,592 KB |
testcase_60 | AC | 237 ms
56,060 KB |
testcase_61 | AC | 173 ms
42,752 KB |
testcase_62 | AC | 264 ms
56,064 KB |
testcase_63 | AC | 249 ms
56,060 KB |
testcase_64 | AC | 130 ms
40,704 KB |
testcase_65 | AC | 194 ms
40,268 KB |
testcase_66 | AC | 193 ms
49,536 KB |
testcase_67 | AC | 268 ms
56,064 KB |
testcase_68 | AC | 292 ms
56,064 KB |
testcase_69 | AC | 171 ms
38,928 KB |
testcase_70 | AC | 155 ms
49,024 KB |
testcase_71 | AC | 159 ms
51,564 KB |
testcase_72 | AC | 219 ms
47,744 KB |
testcase_73 | AC | 175 ms
55,808 KB |
testcase_74 | AC | 301 ms
48,792 KB |
testcase_75 | AC | 193 ms
55,040 KB |
testcase_76 | AC | 269 ms
56,192 KB |
testcase_77 | AC | 267 ms
46,216 KB |
testcase_78 | AC | 305 ms
56,192 KB |
testcase_79 | AC | 295 ms
56,320 KB |
testcase_80 | AC | 294 ms
56,192 KB |
testcase_81 | AC | 227 ms
56,064 KB |
testcase_82 | AC | 902 ms
65,484 KB |
testcase_83 | AC | 908 ms
65,336 KB |
testcase_84 | AC | 920 ms
64,860 KB |
testcase_85 | AC | 912 ms
65,616 KB |
testcase_86 | AC | 778 ms
62,160 KB |
testcase_87 | AC | 959 ms
65,132 KB |
testcase_88 | AC | 937 ms
61,648 KB |
testcase_89 | AC | 928 ms
62,168 KB |
testcase_90 | AC | 922 ms
64,988 KB |
testcase_91 | AC | 916 ms
65,720 KB |
testcase_92 | AC | 924 ms
65,116 KB |
testcase_93 | AC | 920 ms
65,104 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (257 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System open System.Text open System.IO open System.Collections.Generic let reader = new StreamReader(new BufferedStream(Console.OpenStandardInput ())) let read f = while reader.Peek () <= int ' ' do reader.Read () |> ignore [|while reader.Peek () > int ' ' do yield char (reader.Read ())|] |> System.String |> f let N = read int let A = Array.init N (fun _ -> read int) let Q = read int let P = Array.zeroCreate Q let L = Array.zeroCreate Q let R = Array.zeroCreate Q let zero = Array.zeroCreate (N+1) for i in 0..Q-1 do P.[i] <- read int L.[i] <- read int - 1 R.[i] <- read int for i in 0..N-1 do zero.[i+1] <- zero.[i] + (if A.[i] = 0 then 1 else 0) for i in 0..Q-1 do if zero.[R.[i]] - zero.[L.[i]] > 0 then P.[i] <- 1 let table = Array.create 2001 true let primes = new ResizeArray<int>() table.[0] <- false table.[1] <- false for i in 2..2000 do if table.[i] then primes.Add(i) for j in 2*i..i..2000 do table.[j] <- false let ans = Array.create Q true for p in primes do let cnt = Array.zeroCreate (N+1) for i in 0..N-1 do let mutable k = 0 while A.[i] <> 0 && A.[i] % p = 0 do A.[i] <- A.[i] / p k <- k + 1 cnt.[i+1] <- cnt.[i] + k for i in 0..Q-1 do let mutable k = 0 while P.[i] % p = 0 do P.[i] <- P.[i] / p k <- k + 1 if cnt.[R.[i]] - cnt.[L.[i]] < k then ans.[i] <- false for i in 0..Q-1 do if P.[i] <> 1 then ans.[i] <- false printfn "%s" (if ans.[i] then "Yes" else "NO")