ソースコード
with tmp1 as(
select USER_ID,CONTEST_ID,SUBMITTED_AT,POINT,
max(case status when 'AC' then SUBMITTED_AT end)
over(partition by USER_ID,PROBLEM_ID) as ACTime
  from SUBMISSIONS
 where ENTRY_ID is not null
   and CONTEST_ID = 2),
tmp2 as (
select USER_ID,
max(ACTime) as maxACTime,
sum(case when SUBMITTED_AT < ACTime
         then 1 else 0 end) as WACnt,
sum(POINT) as SumPoint,
(select STARTED_AT
   from ENTRIES b
  where b.CONTEST_ID = a.CONTEST_ID
    and b.USER_ID = a.USER_ID) as STARTED_AT
  from tmp1 a
 where ACTime is not null
 group by USER_ID
 having sum(POINT) > 0),
tmp3 as(
select *,strftime('%s',datetime(maxACTime))
       - strftime('%s',datetime(STARTED_AT)) as EX_TIME
 from tmp2)
select rank() over(order by SumPoint desc, EX_TIME + WACnt * 300) as RANK,
USER_ID,
SumPoint as POINT,
EX_TIME + WACnt * 300 as EX_TIME,
WACnt as WRONG_ANS
  from tmp3
order by RANK,WRONG_ANS,USER_ID
提出情報
提出日時2022/10/20 06:11:58
コンテスト第3回 SQLコンテスト
問題順位計算
受験者AketiJyuuzou
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
81 MB
データパターン2
WA
77 MB