結果
問題 | No.854 公平なりんご分配 |
ユーザー | pekempey |
提出日時 | 2019-08-01 19:11:26 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 953 ms / 3,153 ms |
コード長 | 1,381 bytes |
コンパイル時間 | 5,755 ms |
コンパイル使用メモリ | 186,120 KB |
実行使用メモリ | 65,380 KB |
最終ジャッジ日時 | 2024-07-05 07:50:53 |
合計ジャッジ時間 | 32,702 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 63 ms
31,744 KB |
testcase_01 | AC | 65 ms
31,360 KB |
testcase_02 | AC | 64 ms
31,360 KB |
testcase_03 | AC | 64 ms
31,488 KB |
testcase_04 | AC | 63 ms
31,488 KB |
testcase_05 | AC | 69 ms
31,360 KB |
testcase_06 | AC | 63 ms
31,360 KB |
testcase_07 | AC | 63 ms
31,616 KB |
testcase_08 | AC | 64 ms
31,488 KB |
testcase_09 | AC | 65 ms
31,592 KB |
testcase_10 | AC | 62 ms
31,360 KB |
testcase_11 | AC | 65 ms
31,488 KB |
testcase_12 | AC | 68 ms
32,384 KB |
testcase_13 | AC | 68 ms
32,128 KB |
testcase_14 | AC | 64 ms
31,488 KB |
testcase_15 | AC | 63 ms
31,488 KB |
testcase_16 | AC | 67 ms
32,384 KB |
testcase_17 | AC | 65 ms
32,256 KB |
testcase_18 | AC | 67 ms
32,128 KB |
testcase_19 | AC | 67 ms
32,128 KB |
testcase_20 | AC | 67 ms
32,256 KB |
testcase_21 | AC | 66 ms
32,128 KB |
testcase_22 | AC | 72 ms
32,896 KB |
testcase_23 | AC | 69 ms
32,896 KB |
testcase_24 | AC | 74 ms
33,792 KB |
testcase_25 | AC | 68 ms
32,896 KB |
testcase_26 | AC | 74 ms
33,920 KB |
testcase_27 | AC | 72 ms
33,536 KB |
testcase_28 | AC | 71 ms
32,744 KB |
testcase_29 | AC | 67 ms
32,640 KB |
testcase_30 | AC | 68 ms
32,896 KB |
testcase_31 | AC | 74 ms
33,664 KB |
testcase_32 | AC | 147 ms
55,676 KB |
testcase_33 | AC | 173 ms
53,888 KB |
testcase_34 | AC | 242 ms
45,312 KB |
testcase_35 | AC | 186 ms
41,616 KB |
testcase_36 | AC | 173 ms
43,640 KB |
testcase_37 | AC | 143 ms
55,680 KB |
testcase_38 | AC | 126 ms
54,656 KB |
testcase_39 | AC | 349 ms
52,880 KB |
testcase_40 | AC | 195 ms
53,888 KB |
testcase_41 | AC | 193 ms
55,552 KB |
testcase_42 | AC | 220 ms
43,664 KB |
testcase_43 | AC | 264 ms
55,676 KB |
testcase_44 | AC | 271 ms
47,672 KB |
testcase_45 | AC | 298 ms
55,680 KB |
testcase_46 | AC | 339 ms
52,204 KB |
testcase_47 | AC | 161 ms
55,808 KB |
testcase_48 | AC | 205 ms
42,448 KB |
testcase_49 | AC | 193 ms
41,884 KB |
testcase_50 | AC | 134 ms
55,296 KB |
testcase_51 | AC | 332 ms
51,852 KB |
testcase_52 | AC | 297 ms
55,936 KB |
testcase_53 | AC | 200 ms
55,552 KB |
testcase_54 | AC | 291 ms
55,808 KB |
testcase_55 | AC | 145 ms
51,840 KB |
testcase_56 | AC | 126 ms
50,688 KB |
testcase_57 | AC | 181 ms
52,608 KB |
testcase_58 | AC | 293 ms
55,804 KB |
testcase_59 | AC | 121 ms
46,336 KB |
testcase_60 | AC | 225 ms
55,680 KB |
testcase_61 | AC | 152 ms
42,368 KB |
testcase_62 | AC | 247 ms
55,680 KB |
testcase_63 | AC | 237 ms
55,680 KB |
testcase_64 | AC | 115 ms
40,320 KB |
testcase_65 | AC | 172 ms
40,540 KB |
testcase_66 | AC | 178 ms
49,024 KB |
testcase_67 | AC | 250 ms
55,808 KB |
testcase_68 | AC | 277 ms
55,680 KB |
testcase_69 | AC | 158 ms
39,336 KB |
testcase_70 | AC | 141 ms
48,768 KB |
testcase_71 | AC | 153 ms
51,200 KB |
testcase_72 | AC | 214 ms
47,488 KB |
testcase_73 | AC | 164 ms
55,652 KB |
testcase_74 | AC | 295 ms
49,240 KB |
testcase_75 | AC | 182 ms
54,632 KB |
testcase_76 | AC | 264 ms
55,680 KB |
testcase_77 | AC | 256 ms
46,480 KB |
testcase_78 | AC | 301 ms
55,552 KB |
testcase_79 | AC | 295 ms
55,936 KB |
testcase_80 | AC | 265 ms
55,808 KB |
testcase_81 | AC | 226 ms
55,680 KB |
testcase_82 | AC | 929 ms
65,276 KB |
testcase_83 | AC | 921 ms
65,160 KB |
testcase_84 | AC | 923 ms
65,292 KB |
testcase_85 | AC | 953 ms
65,192 KB |
testcase_86 | AC | 771 ms
62,312 KB |
testcase_87 | AC | 932 ms
65,248 KB |
testcase_88 | AC | 930 ms
65,248 KB |
testcase_89 | AC | 922 ms
65,380 KB |
testcase_90 | AC | 927 ms
65,248 KB |
testcase_91 | AC | 918 ms
65,160 KB |
testcase_92 | AC | 926 ms
65,248 KB |
testcase_93 | AC | 938 ms
65,288 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (196 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.Collections.Generic let read f = while stdin.Peek () <= int ' ' do stdin.Read () |> ignore [|while stdin.Peek () > int ' ' do yield char (stdin.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")