ソースコード
SELECT
    RANK() OVER(ORDER BY 
            POINT DESC,
            (strftime('%s', M_AT) - strftime('%s', S_AT) + (WA * 300)) DESC
        ) AS RANK
    ,USER_ID
    ,POINT
    ,(strftime('%s', M_AT) - strftime('%s', S_AT) + (WA * 300)) AS EX_TIME
    ,WA AS WRONG_ANS
FROM
    (
        SELECT
             E.USER_ID
            ,E.STARTED_AT AS S_AT
            ,SUM(S.POINT) AS POINT
            --,MAX(SELECT SUBMITTED_AT FROM SUBMISSIONS)
            ,COUNT(CASE WHEN S.STATUS <> 'AC' AND S.SUBMITTED_AT < AC.SUBMITTED_AT THEN 1 ELSE NULL END ) AS WA
            ,MAX(AC.SUBMITTED_AT) AS M_AT
        FROM
            ENTRIES AS E
            LEFT JOIN
                SUBMISSIONS AS S
            ON
                E.ENTRY_ID = S.ENTRY_ID
            AND E.CONTEST_ID = S.CONTEST_ID
            LEFT JOIN
                (
                    SELECT
                         PROBLEM_ID
                        ,ENTRY_ID
                        ,MAX(SUBMITTED_AT) AS SUBMITTED_AT
                    FROM
                        SUBMISSIONS
                    WHERE
                            CONTEST_ID ='2'
                        AND STATUS = 'AC'
                    GROUP BY
                         PROBLEM_ID
                        ,ENTRY_ID
                ) AS AC
            ON
                    S.PROBLEM_ID = AC.PROBLEM_ID
                AND S.ENTRY_ID = AC.ENTRY_ID
        WHERE
                E.CONTEST_ID ='2'
            AND S.SUBMITTED_AT BETWEEN E.STARTED_AT AND datetime(E.STARTED_AT, '+1 hours')
        GROUP BY
            E.USER_ID
            ,E.STARTED_AT
    ) AS TBL
提出情報
提出日時2022/10/20 00:34:11
コンテスト第3回 SQLコンテスト
問題順位計算
受験者SI_KK
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量97 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
97 MB
データパターン2
WA
97 MB