結果
問題 | No.854 公平なりんご分配 |
ユーザー | pekempey |
提出日時 | 2019-08-01 19:31:44 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 1,012 ms / 3,153 ms |
コード長 | 1,674 bytes |
コンパイル時間 | 6,745 ms |
コンパイル使用メモリ | 184,700 KB |
実行使用メモリ | 86,984 KB |
最終ジャッジ日時 | 2024-07-05 07:54:02 |
合計ジャッジ時間 | 35,592 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 81 ms
41,192 KB |
testcase_01 | AC | 78 ms
41,344 KB |
testcase_02 | AC | 79 ms
41,252 KB |
testcase_03 | AC | 79 ms
41,380 KB |
testcase_04 | AC | 77 ms
41,256 KB |
testcase_05 | AC | 78 ms
41,088 KB |
testcase_06 | AC | 78 ms
41,472 KB |
testcase_07 | AC | 77 ms
41,088 KB |
testcase_08 | AC | 78 ms
41,344 KB |
testcase_09 | AC | 78 ms
41,216 KB |
testcase_10 | AC | 78 ms
41,088 KB |
testcase_11 | AC | 78 ms
41,188 KB |
testcase_12 | AC | 82 ms
41,892 KB |
testcase_13 | AC | 83 ms
42,152 KB |
testcase_14 | AC | 79 ms
41,256 KB |
testcase_15 | AC | 79 ms
41,252 KB |
testcase_16 | AC | 82 ms
42,020 KB |
testcase_17 | AC | 82 ms
41,984 KB |
testcase_18 | AC | 83 ms
41,984 KB |
testcase_19 | AC | 83 ms
41,764 KB |
testcase_20 | AC | 83 ms
41,856 KB |
testcase_21 | AC | 83 ms
41,764 KB |
testcase_22 | AC | 88 ms
42,112 KB |
testcase_23 | AC | 85 ms
42,496 KB |
testcase_24 | AC | 89 ms
42,912 KB |
testcase_25 | AC | 86 ms
42,344 KB |
testcase_26 | AC | 89 ms
42,788 KB |
testcase_27 | AC | 84 ms
42,656 KB |
testcase_28 | AC | 86 ms
41,856 KB |
testcase_29 | AC | 83 ms
42,112 KB |
testcase_30 | AC | 83 ms
42,112 KB |
testcase_31 | AC | 90 ms
42,664 KB |
testcase_32 | AC | 170 ms
65,280 KB |
testcase_33 | AC | 189 ms
57,600 KB |
testcase_34 | AC | 284 ms
75,008 KB |
testcase_35 | AC | 206 ms
71,332 KB |
testcase_36 | AC | 178 ms
46,760 KB |
testcase_37 | AC | 161 ms
65,064 KB |
testcase_38 | AC | 143 ms
61,220 KB |
testcase_39 | AC | 357 ms
74,856 KB |
testcase_40 | AC | 196 ms
56,192 KB |
testcase_41 | AC | 205 ms
65,152 KB |
testcase_42 | AC | 235 ms
78,440 KB |
testcase_43 | AC | 281 ms
65,280 KB |
testcase_44 | AC | 288 ms
77,800 KB |
testcase_45 | AC | 297 ms
55,208 KB |
testcase_46 | AC | 342 ms
79,744 KB |
testcase_47 | AC | 177 ms
61,184 KB |
testcase_48 | AC | 219 ms
77,816 KB |
testcase_49 | AC | 214 ms
75,008 KB |
testcase_50 | AC | 166 ms
65,272 KB |
testcase_51 | AC | 334 ms
81,280 KB |
testcase_52 | AC | 295 ms
63,120 KB |
testcase_53 | AC | 195 ms
58,880 KB |
testcase_54 | AC | 301 ms
65,408 KB |
testcase_55 | AC | 154 ms
57,380 KB |
testcase_56 | AC | 141 ms
57,508 KB |
testcase_57 | AC | 183 ms
56,448 KB |
testcase_58 | AC | 292 ms
53,796 KB |
testcase_59 | AC | 130 ms
53,120 KB |
testcase_60 | AC | 227 ms
57,896 KB |
testcase_61 | AC | 158 ms
46,884 KB |
testcase_62 | AC | 247 ms
57,344 KB |
testcase_63 | AC | 237 ms
56,980 KB |
testcase_64 | AC | 125 ms
47,140 KB |
testcase_65 | AC | 196 ms
73,344 KB |
testcase_66 | AC | 186 ms
52,224 KB |
testcase_67 | AC | 262 ms
65,536 KB |
testcase_68 | AC | 283 ms
56,320 KB |
testcase_69 | AC | 186 ms
74,880 KB |
testcase_70 | AC | 147 ms
54,632 KB |
testcase_71 | AC | 158 ms
56,448 KB |
testcase_72 | AC | 216 ms
48,424 KB |
testcase_73 | AC | 182 ms
65,188 KB |
testcase_74 | AC | 302 ms
76,800 KB |
testcase_75 | AC | 190 ms
57,444 KB |
testcase_76 | AC | 272 ms
65,656 KB |
testcase_77 | AC | 267 ms
79,268 KB |
testcase_78 | AC | 296 ms
58,276 KB |
testcase_79 | AC | 302 ms
65,536 KB |
testcase_80 | AC | 278 ms
65,536 KB |
testcase_81 | AC | 235 ms
65,280 KB |
testcase_82 | AC | 965 ms
75,916 KB |
testcase_83 | AC | 970 ms
75,924 KB |
testcase_84 | AC | 969 ms
76,044 KB |
testcase_85 | AC | 1,012 ms
76,292 KB |
testcase_86 | AC | 827 ms
86,984 KB |
testcase_87 | AC | 962 ms
76,048 KB |
testcase_88 | AC | 978 ms
76,160 KB |
testcase_89 | AC | 977 ms
75,920 KB |
testcase_90 | AC | 975 ms
76,040 KB |
testcase_91 | AC | 966 ms
76,048 KB |
testcase_92 | AC | 964 ms
76,040 KB |
testcase_93 | AC | 981 ms
75,916 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (226 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 buf = Array.create 5000000 ' ' let mutable bufn = 0 let mutable bufk = 0 let peek () = if bufk = bufn then bufn <- stdin.Read(buf, 0, buf.Length) bufk <- 0 int buf.[bufk] let next () = let ans = buf.[bufk] bufk <- bufk + 1 int ans let read_int () = while peek () <= int ' ' do next () |> ignore let mutable ans = 0 while peek () > int ' ' do ans <- ans * 10 + (next () - 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")