ソースコード
with c as (
    select
        e.USER_ID as c_USER_ID,
        sum(s.POINT) as c_POINT,
        (
            max(
                case when s.SUBMITTED_AT = (
                    select max(s2.SUBMITTED_AT)
                    from SUBMISSIONS s2
                    where s2.ENTRY_ID = s.ENTRY_ID and s2.STATUS = 'AC' 
                )
                then STRFTIME('%s', s.SUBMITTED_AT)
                end
            ) - STRFTIME('%s', e.STARTED_AT)
        ) as c_EX_TIME,
        sum(
            case when s.SUBMITTED_AT < (
                select max(s2.SUBMITTED_AT)
                from SUBMISSIONS s2
                where s2.ENTRY_ID = s.ENTRY_ID and s2.PROBLEM_ID = s.PROBLEM_ID and s2.STATUS = 'AC' 
            )
            then 
                case when s.STATUS <> 'AC' then 1 else 0 end
            else 0
            end
        ) as c_WRONG_ANS
    from ENTRIES e
    inner join
        SUBMISSIONS s
        on s.ENTRY_ID = e.ENTRY_ID
    where
        e.CONTEST_ID = 2
    group by
        e.USER_ID,
        s.PROBLEM_ID
)
select
    rank() over (order by sum(c_POINT) desc, max(c_EX_TIME) + (300 * sum(c_WRONG_ANS))) as RANK,
    c_USER_ID as USER_ID,
    sum(c_POINT) as POINT,
    max(c_EX_TIME) + (300 * sum(c_WRONG_ANS)) as EX_TIME,
    sum(c_WRONG_ANS) as WRONG_ANS
from c
group by c_USER_ID
having sum(c_POINT) <> 0
order by
    RANK,
    WRONG_ANS,
    USER_ID;
提出情報
提出日時2024/07/10 16:57:54
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tofu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
WA
84 MB