ソースコード
with SUB as ( 
    select  *
    from SUBMISSIONS as S
    inner join ENTRIES  as E on E.entry_id = S.entry_id 
    where S.contest_id = 2
) , AC as (
    select problem_id , user_id , point ,strftime('%s',submitted_at) - strftime('%s',started_at) as time
    , submitted_at as ac_time
    from SUB where status = 'AC'
) , WA as (
    select S.problem_id , S.user_id , count(*) as wa_cnt
    from SUB as S inner join AC on S.problem_id = AC.problem_id and S.user_id = AC.user_id
    where status ='WA' and submitted_at < AC.ac_time
    group by S.problem_id , S.user_id
)
select rank() over ( order by sum(point) desc, max(time) + sum( coalesce(wa_cnt,0) )  *5 *60) as RANK
    , AC.user_id as USER_ID
    , sum(point) as POINT
    , max(time) + sum( coalesce(wa_cnt,0) ) *5 *60  as EX_TIME
    , sum( coalesce(wa_cnt,0) ) as WRONG_ANS
from AC left outer join WA on AC.problem_id = WA.problem_id and AC.user_id = WA.user_id
group by AC.user_id
order by POINT desc, EX_TIME, WRONG_ANS, USER_ID  
提出情報
提出日時2023/10/27 15:36:13
コンテスト第3回 SQLコンテスト
問題順位計算
受験者hmasa
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
78 MB
データパターン2
WA
78 MB