ソースコード
with timetbl as (
    select 
        su.user_id as USER_ID,
        su.entry_id,
        su.problem_id,
        strftime('%s', max(submitted_at)) - strftime('%s', en.started_at) as EX_TIME,
        max(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.entry_id
)
select 
    rank() over(order by point desc,EX_TIME+300*wrong_ans) as RANK ,
    USER_ID,
    POINT,
    EX_TIME+300*wrong_ans as EX_TIME,
    WRONG_ANS 
from tbl 
where point>0 
order by rank,wrong_ans,user_id;
提出情報
提出日時2023/09/17 17:54:39
コンテスト第3回 SQLコンテスト
問題順位計算
受験者kate
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量78 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
77 MB
データパターン2
WA
78 MB