ソースコード
WITH WS AS (
    SELECT
        USER_ID,
        SUM(POINT) AS POINT,
        MAX(strftime('%s', SUBMITTED_AT) - strftime('%s', STARTED_AT)) + SUM(CASE WHEN STATUS != 'AC' THEN 300 ELSE 0 END) AS EX_TIME,
        SUM(CASE WHEN STATUS != 'AC' THEN 1 ELSE 0 END) AS WRONG_ANS
    FROM SUBMISSIONS S
    JOIN ENTRIES USING(ENTRY_ID, CONTEST_ID, USER_ID)
    WHERE CONTEST_ID = '2' AND EXISTS(
        SELECT 1 FROM SUBMISSIONS 
        WHERE STATUS='AC' AND S.CONTEST_ID=CONTEST_ID AND S.PROBLEM_ID=PROBLEM_ID 
        AND S.USER_ID=USER_ID AND S.ENTRY_ID=ENTRY_ID AND S.SUBMITTED_AT<=SUBMITTED_AT
    )
    GROUP BY USER_ID HAVING POINT > 0
) 
SELECT
    RANK() OVER(ORDER BY POINT DESC, EX_TIME) AS RANK,
    USER_ID,
    POINT,
    EX_TIME,
    WRONG_ANS
FROM WS
ORDER BY RANK, WRONG_ANS, USER_ID
提出情報
提出日時2023/12/11 18:54:03
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tkiry
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
84 MB