ソースコード
select
rank()over(order by point desc,ex_time asc) as RANK
,USER_ID
,POINT
,EX_TIME
,WORNG_ANS from(
select
e.user_id as USER_ID
,sum(f.point) as POINT
,(strftime('%s',f.f_time)-strftime('%s',e.started_at)) + (ifnull(worng,0)*300) as EX_TIME
,ifnull(worng,0) as WORNG_ANS
from entries as e
inner join
(
    select
    contest_id
    ,problem_id
    ,entry_id
    ,max(submitted_at) as f_time
    ,point
    from submissions as s
    where status='AC'
    and entry_id is not null
    group by
    contest_id
    ,problem_id
    ,entry_id
    ,point
    order by f_time desc
) as f
on e.entry_id = f.entry_id
left outer join
(
    select s.entry_id,count(*)as worng from submissions as s
    inner join (
    select
    contest_id
    ,problem_id
    ,entry_id
    ,max(submitted_at) as f_time
    ,point
    from submissions as s
    where status='AC'
    and entry_id is not null
    group by
    contest_id
    ,problem_id
    ,entry_id
    ,point
    ) as f
    on s.entry_id= f.entry_id
    and s.problem_id =f.problem_id
    where status = 'WA'
    group by s.entry_id
) as w
on w.entry_id=e.entry_id
where point <> 0
group by e.entry_id)
where point <> 0
order by rank,ex_time,worng_ans
提出情報
提出日時2024/04/25 12:00:09
コンテスト第3回 SQLコンテスト
問題順位計算
受験者HamamatsuUnagi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
87 MB