ソースコード
WITH WS AS (
    SELECT
        USER_ID,
        SUM(POINT) AS POINT,
        MAX(strftime('%s', LAST_AC_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
    JOIN ENTRIES USING(ENTRY_ID, CONTEST_ID, USER_ID)
    JOIN (
        SELECT
            ENTRY_ID,
            PROBLEM_ID,
            MAX(SUBMITTED_AT) AS LAST_AC_AT
        FROM SUBMISSIONS
        WHERE STATUS = 'AC'
        GROUP BY ENTRY_ID, PROBLEM_ID
    ) AS S_AC USING(ENTRY_ID, PROBLEM_ID)
    WHERE SUBMITTED_AT <= LAST_AC_AT AND CONTEST_ID = '2'
    GROUP BY USER_ID
) 
SELECT
    RANK() OVER(ORDER BY POINT DESC, EX_TIME) AS RANK,
    USER_ID,
    POINT,
    EX_TIME,
    WRONG_ANS
FROM WS
WHERE POINT > 0
ORDER BY RANK, WRONG_ANS, USER_ID
提出情報
提出日時2023/12/11 18:42:44
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tkiry
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
WA
84 MB