ソースコード
WITH WS AS (
    SELECT
        USER_ID,
        SUM(POINT) AS POINT,
        MAX(strftime('%s', LAST_AC_AT) - strftime('%s', STARTED_AT)) + ( 300 * SUM(CASE WHEN STATUS != 'AC' THEN 1 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
    HAVING SUM(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, EX_TIME, USER_ID
提出情報
提出日時2023/12/11 17:59:22
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tkiry
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
WA
85 MB