ソースコード
select RANK() over(order by b.POINT desc, b.EX_TIME) RANK
, b.USER_ID
, b.POINT
--, b.STARTED_AT, b.MAX_SUBMITTED_AT
, b.EX_TIME
, b.WRONG_ANS
from (
select s1.USER_ID
, sum(S1.POINT) POINT 
, sum(case when s1.STATUS != 'AC' then 1 else 0 end) WRONG_ANS
, (strftime('%s', a.MAX_SUBMITTED_AT) - strftime('%s', e.STARTED_AT))
  + (sum(case when s1.STATUS != 'AC' then 1 else 0 end) * 300)
 as EX_TIME
 , e.STARTED_AT
 , a.MAX_SUBMITTED_AT
from (
select  s0.USER_ID
, s0.ENTRY_ID, s0.CONTEST_ID
, max(s0.SUBMITTED_AT) MAX_SUBMITTED_AT
from SUBMISSIONS s0
where s0.CONTEST_ID = 2
and s0.STATUS = 'AC'
and s0.ENTRY_ID is not null
group by s0.USER_ID
, s0.ENTRY_ID, s0.CONTEST_ID
) a
inner join ENTRIES e
  on e.ENTRY_ID = a.ENTRY_ID
  and e.CONTEST_ID = a.CONTEST_ID
  and e.USER_ID = a.USER_ID
inner join SUBMISSIONS s1
  on s1.USER_ID = a.USER_ID
  and s1.ENTRY_ID = a.ENTRY_ID
  and s1.CONTEST_ID = a.CONTEST_ID
  and s1.SUBMITTED_AT <= a.MAX_SUBMITTED_AT
  
group by s1.USER_ID
having sum(S1.POINT) > 0
) b
order by RANK
, WRONG_ANS
, USER_ID
;


提出情報
提出日時2022/10/20 00:36:17
コンテスト第3回 SQLコンテスト
問題順位計算
受験者kiharu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量101 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
101 MB
データパターン2
AC
98 MB