結果
| 問題 | No.504 ゲーム大会(ランキング) | 
| コンテスト | |
| ユーザー |  kou_kkk | 
| 提出日時 | 2025-06-28 22:03:28 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 394 ms / 2,000 ms | 
| コード長 | 279 bytes | 
| コンパイル時間 | 9,289 ms | 
| コンパイル使用メモリ | 175,616 KB | 
| 実行使用メモリ | 56,320 KB | 
| 最終ジャッジ日時 | 2025-06-28 22:03:42 | 
| 合計ジャッジ時間 | 10,206 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 | 
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
Main.hs:12:26: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Replace it with 'drop' 1, or use pattern matching or 'GHC.Internal.Data.List.uncons' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
12 | solve a = scanl step 1 $ tail a
   |                          ^^^^
Main.hs:14:20: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.Internal.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
   |
14 |   step acc x | x > head a = succ acc
   |                    ^^^^
[2 of 2] Linking a.out
            
            ソースコード
module Main where
 
import Control.Monad (replicateM)
 
main :: IO ()
main = do
  n <- readLn
  a <- replicateM n readLn
  mapM_ print $ solve a
 
solve :: [Int] -> [Int]
solve a = scanl step 1 $ tail a
  where
  step acc x | x > head a = succ acc
             | otherwise  = acc
            
            
            
        