ソースコード
with
sub as (
    select
        user_id
        ,ENTRY_ID
        ,max(min_ac_sub) as max_sub
        ,sum(case when STATUS = 'AC' then POINT else 0 end) as POINT
        ,sum(case when STATUS != 'AC' and SUBMITTED_AT < min_ac_sub then 1 else 0 end) as WRONG_ANS    
    from (
        select
            *
            ,min(case when STATUS = 'AC' then SUBMITTED_AT else null end) over(partition by user_id, problem_id) as min_ac_sub
        from SUBMISSIONS
        where CONTEST_ID = 2
        and ENTRY_ID is not null
    ) a
    group by user_id,ENTRY_ID
)
select 
rank() over(order by point desc, strftime('%s', s.max_sub) - strftime('%s', e.STARTED_AT) + 300*s.WRONG_ANS) as RANK
,s.user_id as USER_ID
,s.point as POINT
,strftime('%s', s.max_sub) - strftime('%s', e.STARTED_AT) as EX_TIME
,s.WRONG_ANS as WRONG_ANS
from sub s
join ENTRIES e
    on s.ENTRY_ID = e.ENTRY_ID
where point > 0
order by 
RANK, WRONG_ANS, s.USER_ID
提出情報
提出日時2022/10/20 00:55:14
コンテスト第3回 SQLコンテスト
問題順位計算
受験者teshikenn
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量103 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
103 MB
データパターン2
WA
98 MB