ソースコード
with sub as 
(
select
    PROBLEM_ID
    ,USER_ID
    ,ENTRY_ID
    ,SUBMITTED_AT
    ,STATUS
    ,POINT
    ,COUNT() over(partition by ENTRY_ID,PROBLEM_ID ORDER BY SUBMITTED_AT ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as WRONG_ANS
from 
    SUBMISSIONS
where
    CONTEST_ID=2 and ENTRY_ID is not null
)
, sub2 as (
select
    USER_ID
    ,ENTRY_ID
    ,sum(POINT) as POINT
    ,max(SUBMITTED_AT) as END_AT
    ,sum(WRONG_ANS) as WRONG_ANS
from
    sub
where
    STATUS="AC"
group by
    ENTRY_ID
)
select
    rank() over(order by POINT desc,strftime("%s",END_AT) - strftime("%s",STARTED_AT) + WRONG_ANS*300) as `RANK`
    ,sub2.USER_ID
    ,POINT
    ,strftime("%s",END_AT) - strftime("%s",STARTED_AT) + WRONG_ANS*300 as EX_TIME
    ,WRONG_ANS
from
    sub2
    inner join
    ENTRIES as et
    on sub2.ENTRY_ID = et.ENTRY_ID
order by
    `RANK`
    ,WRONG_ANS
    ,sub2.USER_ID
提出情報
提出日時2024/03/08 17:41:57
コンテスト第3回 SQLコンテスト
問題順位計算
受験者gP2fWnUzTL
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
WA
84 MB