結果
問題 | No.854 公平なりんご分配 |
ユーザー | pekempey |
提出日時 | 2019-08-01 19:24:20 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 1,028 ms / 3,153 ms |
コード長 | 1,693 bytes |
コンパイル時間 | 7,091 ms |
コンパイル使用メモリ | 187,904 KB |
実行使用メモリ | 61,044 KB |
最終ジャッジ日時 | 2024-07-05 07:52:59 |
合計ジャッジ時間 | 37,339 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
31,232 KB |
testcase_01 | AC | 71 ms
31,104 KB |
testcase_02 | AC | 68 ms
31,332 KB |
testcase_03 | AC | 67 ms
31,104 KB |
testcase_04 | AC | 69 ms
31,360 KB |
testcase_05 | AC | 67 ms
31,104 KB |
testcase_06 | AC | 68 ms
31,104 KB |
testcase_07 | AC | 71 ms
31,232 KB |
testcase_08 | AC | 70 ms
31,104 KB |
testcase_09 | AC | 69 ms
31,360 KB |
testcase_10 | AC | 69 ms
31,332 KB |
testcase_11 | AC | 69 ms
31,232 KB |
testcase_12 | AC | 78 ms
32,360 KB |
testcase_13 | AC | 73 ms
32,384 KB |
testcase_14 | AC | 67 ms
31,104 KB |
testcase_15 | AC | 69 ms
31,232 KB |
testcase_16 | AC | 70 ms
32,128 KB |
testcase_17 | AC | 72 ms
32,512 KB |
testcase_18 | AC | 74 ms
32,128 KB |
testcase_19 | AC | 72 ms
32,256 KB |
testcase_20 | AC | 71 ms
32,128 KB |
testcase_21 | AC | 75 ms
32,256 KB |
testcase_22 | AC | 79 ms
32,512 KB |
testcase_23 | AC | 76 ms
33,024 KB |
testcase_24 | AC | 82 ms
33,280 KB |
testcase_25 | AC | 74 ms
32,896 KB |
testcase_26 | AC | 80 ms
33,764 KB |
testcase_27 | AC | 77 ms
33,280 KB |
testcase_28 | AC | 79 ms
32,640 KB |
testcase_29 | AC | 75 ms
32,512 KB |
testcase_30 | AC | 75 ms
32,768 KB |
testcase_31 | AC | 80 ms
33,152 KB |
testcase_32 | AC | 159 ms
55,552 KB |
testcase_33 | AC | 181 ms
48,384 KB |
testcase_34 | AC | 261 ms
36,608 KB |
testcase_35 | AC | 205 ms
36,608 KB |
testcase_36 | AC | 175 ms
37,248 KB |
testcase_37 | AC | 162 ms
55,552 KB |
testcase_38 | AC | 139 ms
52,096 KB |
testcase_39 | AC | 360 ms
41,932 KB |
testcase_40 | AC | 201 ms
46,976 KB |
testcase_41 | AC | 208 ms
55,552 KB |
testcase_42 | AC | 228 ms
38,096 KB |
testcase_43 | AC | 274 ms
55,936 KB |
testcase_44 | AC | 277 ms
37,548 KB |
testcase_45 | AC | 295 ms
45,696 KB |
testcase_46 | AC | 342 ms
42,284 KB |
testcase_47 | AC | 175 ms
51,456 KB |
testcase_48 | AC | 223 ms
37,548 KB |
testcase_49 | AC | 205 ms
37,028 KB |
testcase_50 | AC | 147 ms
55,680 KB |
testcase_51 | AC | 335 ms
41,132 KB |
testcase_52 | AC | 316 ms
53,376 KB |
testcase_53 | AC | 205 ms
49,536 KB |
testcase_54 | AC | 299 ms
55,936 KB |
testcase_55 | AC | 153 ms
47,616 KB |
testcase_56 | AC | 142 ms
47,848 KB |
testcase_57 | AC | 188 ms
46,848 KB |
testcase_58 | AC | 295 ms
44,288 KB |
testcase_59 | AC | 128 ms
43,520 KB |
testcase_60 | AC | 230 ms
48,512 KB |
testcase_61 | AC | 157 ms
37,088 KB |
testcase_62 | AC | 252 ms
47,616 KB |
testcase_63 | AC | 230 ms
47,488 KB |
testcase_64 | AC | 120 ms
37,504 KB |
testcase_65 | AC | 187 ms
35,712 KB |
testcase_66 | AC | 182 ms
42,880 KB |
testcase_67 | AC | 270 ms
55,928 KB |
testcase_68 | AC | 272 ms
46,848 KB |
testcase_69 | AC | 193 ms
35,180 KB |
testcase_70 | AC | 163 ms
45,056 KB |
testcase_71 | AC | 174 ms
46,592 KB |
testcase_72 | AC | 234 ms
38,784 KB |
testcase_73 | AC | 202 ms
55,808 KB |
testcase_74 | AC | 314 ms
40,020 KB |
testcase_75 | AC | 190 ms
48,000 KB |
testcase_76 | AC | 288 ms
55,912 KB |
testcase_77 | AC | 270 ms
39,320 KB |
testcase_78 | AC | 305 ms
48,384 KB |
testcase_79 | AC | 317 ms
55,808 KB |
testcase_80 | AC | 286 ms
55,808 KB |
testcase_81 | AC | 235 ms
55,680 KB |
testcase_82 | AC | 984 ms
60,936 KB |
testcase_83 | AC | 960 ms
60,880 KB |
testcase_84 | AC | 996 ms
60,680 KB |
testcase_85 | AC | 1,028 ms
60,788 KB |
testcase_86 | AC | 848 ms
55,816 KB |
testcase_87 | AC | 983 ms
61,044 KB |
testcase_88 | AC | 992 ms
60,792 KB |
testcase_89 | AC | 972 ms
60,920 KB |
testcase_90 | AC | 1,002 ms
60,920 KB |
testcase_91 | AC | 957 ms
60,660 KB |
testcase_92 | AC | 1,001 ms
60,780 KB |
testcase_93 | AC | 1,007 ms
60,688 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (238 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 read_int () = while reader.Peek () <= int ' ' do reader.Read () |> ignore let mutable ans = 0 while reader.Peek () > int ' ' do ans <- ans * 10 + (reader.Read () - int '0') ans 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")