ソースコード
-- select strftime('%s', '2022-07-20 17:00:47') - strftime('%s', '2022-07-20 19:00:10')
with TMP1 as (
    select
        case
            when S.STATUS='AC' then 0
            ELSE 1
        end as STATUS_NUM
        , S.*
        , E.STARTED_AT
    from ENTRIES as E
    inner join SUBMISSIONS as S
        on E.ENTRY_ID=S.ENTRY_ID
    where E.CONTEST_ID=2
), TMP2 as (
    select
        *
        , sum(STATUS_NUM)
            over(partition by USER_ID, PROBLEM_ID order by SUBMITTED_AT rows between unbounded preceding and current row) as PEN
    from TMP1 as T
), TMP3 as (
    select
        USER_ID
        , POINT
        , strftime('%s', SUBMITTED_AT) - strftime('%s', STARTED_AT) as SUB_TIME
        , 300 * PEN as PEN_TIME
        , PEN
    from TMP2
    where STATUS='AC')
select
    rank() over(order by POINT desc, EX_TIME asc) as RANK
    , *
from (select
        USER_ID
        , sum(POINT) as POINT
        , sum(PEN_TIME) + max(SUB_TIME) as EX_TIME
        , sum(PEN) as WRONG_ANSWER    
    from TMP3
    group by USER_ID)
order by RANK , WRONG_ANSWER, USER_ID;
提出情報
提出日時2024/10/08 10:12:42
コンテスト第3回 SQLコンテスト
問題順位計算
受験者poapoa1010
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
85 MB