ソースコード
with table2 as
(
select 
  USER_ID
  ,count(0) as WRONG_ANS
from SUBMISSIONS
where status='WA'
group by 1
)
,table1 as
(
select 
  a.USER_ID
  ,sum(a.POINT) as POINT
  ,max(a.SUBMITTED_AT) as SUBMITTED_AT
  ,min(b.STARTED_AT) as STARTED_AT
from SUBMISSIONS a
inner join
(
  select ENTRY_ID, USER_ID, STARTED_AT
  from ENTRIES
  where CONTEST_ID=2
) b
on a.USER_ID=b.USER_ID
where a.status='AC'
group by 1
)
select 
  RANK() OVER(ORDER BY a.POINT desc, strftime('%s', a.SUBMITTED_AT) - strftime('%s', a.STARTED_AT) + b.WRONG_ANS*300 asc) as RANK
  ,a.USER_ID
  ,a.POINT
  ,strftime('%s', a.SUBMITTED_AT) - strftime('%s', a.STARTED_AT) + b.WRONG_ANS*300 as EX_TIME
  ,b.WRONG_ANS
from table1 a
inner join table2 b
on a.USER_ID=b.USER_ID
order by 1 asc, 5 asc, 2 asc
提出情報
提出日時2022/10/20 10:03:57
コンテスト第3回 SQLコンテスト
問題順位計算
受験者kevin
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
96 MB
データパターン2
WA
100 MB