結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー maimai8
提出日時 2020-07-30 16:44:19
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 14,776 KB
最終ジャッジ日時 2024-10-09 01:52:35
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let lst = Array.to_list (Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d) in
  let lst = List.fast_sort compare lst in
  let h, t = List.hd lst, List.tl lst in
  let ((cnt,ans),(buf,n)) = List.fold_left 
      (fun ((cnt,ans),(buf,n)) x -> 
        if n = x then ((cnt,ans),(buf+1,n))
        else if cnt <= buf then ((buf,n),(1,x))
        else ((cnt,ans),(1,x))) ((0,-1),(1,h)) t in
  Printf.printf "%d\n" (if cnt = buf then n else ans)
0