ソースコード
with penalty as (
    select 
        s.entry_id
        , count(submit_id) as wrong_ans
    from submissions s
    inner join (
        select
            entry_id
            , problem_id
            , max(submitted_at) as last_submitted_at
        from submissions
        where status='AC'
        and   entry_id is not null
        and   contest_id=2
        group by entry_id, problem_id
    ) as sub1
        on s.entry_id=sub1.entry_id
        and s.problem_id=sub1.problem_id
        and s.submitted_at < sub1.last_submitted_at
    group by s.entry_id
),
score_and_time as (
    select 
        entry_id
        , sum(point) as point
        , max(submitted_at) as last_submitted_at
    from submissions s
    where status='AC'
    and   entry_id is not null
    and   contest_id=2
    group by entry_id
)
select 
    rank() over (order by point desc, strftime('%s',last_submitted_at)-strftime('%s',started_at)+5*60*ifnull(wrong_ans,0) asc) as RANK
    , e.user_id as USER_ID
    , point as POINT
    , strftime('%s',last_submitted_at)-strftime('%s',started_at)+5*60*ifnull(p.wrong_ans,0) as EX_TIME
    , ifnull(wrong_ans,0) as wrong_ans
from entries as e
left join penalty as p on e.entry_id=p.entry_id 
join score_and_time sat on e.entry_id=sat.entry_id
where e.contest_id=2
order by rank asc, wrong_ans asc, user_id asc;
提出情報
提出日時2024/05/14 17:05:41
コンテスト第3回 SQLコンテスト
問題順位計算
受験者sjty9561
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
86 MB