結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-07 21:23:13 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 1,000 ms |
| コード長 | 945 bytes |
| コンパイル時間 | 13,090 ms |
| コンパイル使用メモリ | 184,764 KB |
| 実行使用メモリ | 32,000 KB |
| 最終ジャッジ日時 | 2024-09-14 14:52:00 |
| 合計ジャッジ時間 | 16,643 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (535 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/
ソースコード
let solve a_seq b_seq =
let ab_seq = Seq.zip a_seq b_seq
let other_score =
Seq.filter (fun (a, b) -> b <> 0) ab_seq
|> fun sq ->
if Seq.isEmpty sq then
0
else
sq
|> Seq.groupBy (fun (a, b) -> b)
|> Seq.map (
fun (b, ab_seq) -> Seq.sumBy (fun (a, b) -> a) ab_seq)
|> Seq.maxBy id
let k_score =
Seq.filter (fun (a, b) -> b = 0) ab_seq
|> fun sq ->
if Seq.isEmpty sq then
0
else
sq
|> Seq.sumBy (fun (a, b) -> a)
if k_score >= other_score then
"YES"
else
"NO"
let () =
let _ = stdin.ReadLine()
let a_lst = stdin.ReadLine().Split()
|> Seq.map int
let b_lst = stdin.ReadLine().Split()
|> Seq.map int
solve a_lst b_lst
|> printfn "%s"