ソースコード
with sub as 
(
select
    PROBLEM_ID
    ,USER_ID
    ,ENTRY_ID
    ,strftime("%s",SUBMITTED_AT) as tt
    ,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(tt) as tt
    ,sum(WRONG_ANS) as WRONG_ANS
from
    sub
where
    STATUS="AC"
group by
    ENTRY_ID
)
select
    rank() over(order by POINT desc,tt - strftime("%s",STARTED_AT) + WRONG_ANS*300) as `RANK`
    ,sub2.USER_ID
    ,POINT
    ,tt - 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:34:35
コンテスト第3回 SQLコンテスト
問題順位計算
受験者gP2fWnUzTL
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量83 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
82 MB
データパターン2
WA
83 MB