ソースコード
with timetbl as (
    select 
        su.user_id as USER_ID,
        su.entry_id,
        su.problem_id,
        su.point,
        strftime('%s', submitted_at) - strftime('%s', en.started_at) as EX_TIME,
        submitted_at as maxtime 
    from submissions as su 
    inner join entries as en 
    on su.entry_id=en.entry_id 
    where su.status='AC' 
    and su.contest_id=2 
    and su.entry_id is not null 
    group by su.entry_id,problem_id 
),tbl as (
    select 
        timetbl.USER_ID,
        sum(su.point) as POINT,
        max(timetbl.EX_TIME) as ex_time,
        sum(iif(status='WA',1,0)) as WRONG_ANS  
    from timetbl 
    inner join submissions as su 
    on timetbl.entry_id=su.entry_id 
    and timetbl.problem_id=su.problem_id 
    where su.submitted_at<=timetbl.maxtime 
    and su.contest_id=2 
    and su.entry_id is not null 
    group by timetbl.entry_id 
    order by timetbl.user_id 
)
select 
    rank() over(order by point desc,EX_TIME+300*ifnull(wrong_ans,0)) as RANK ,
    USER_ID,
    POINT,
    EX_TIME+300*ifnull(wrong_ans,0) as EX_TIME,
    ifnull(WRONG_ANS ,0) as WRONG_ANS 
from tbl 
where point>0 
order by rank,wrong_ans,user_id;
提出情報
提出日時2023/09/17 19:10:18
コンテスト第3回 SQLコンテスト
問題順位計算
受験者kate
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量77 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
76 MB
データパターン2
WA
77 MB