ソースコード
with tmp1 as(
select USER_ID,CONTEST_ID,POINT,
datetime(SUBMITTED_AT) as SUBMITTED_AT,
max(case status when 'AC' then datetime(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 b.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',maxACTime) - strftime('%s',STARTED_AT) + WACnt * 300 as EX_TIME
 from tmp2)
select rank() over(order by SumPoint desc, EX_TIME) as RANK,
USER_ID,SumPoint as POINT,EX_TIME,WACnt as WRONG_ANS
  from tmp3
order by RANK,WACnt,USER_ID
提出情報
提出日時2022/10/20 06:45:20
コンテスト第3回 SQLコンテスト
問題順位計算
受験者AketiJyuuzou
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
WA
80 MB