ソースコード
    WITH E(USER_ID, CONTEST_ID, ENTRY_ID, PROBLEM_ID, AC_AT) AS (
        SELECT
                USER_ID
                , CONTEST_ID
                , ENTRY_ID
                , PROBLEM_ID
                , MAX(SUBMITTED_AT) AS AC_AT
            FROM
                SUBMISSIONS
            WHERE
                CONTEST_ID = 2
                AND STATUS = 'AC'
                AND ENTRY_ID IS NOT NULL
            GROUP BY
                USER_ID, CONTEST_ID, ENTRY_ID, PROBLEM_ID
        )
SELECT
    RANK() OVER (
        ORDER BY POINT DESC, EX_TIME) AS "RANK"
    , USER_ID
    , POINT
    , EX_TIME
    , WRONG_ANS
    FROM
        (
SELECT
        USER_ID
        , POINT
        , unixepoch(ENDED_AT)
                - unixepoch(STARTED_AT)
                + 300 * WRONG_ANS
            AS EX_TIME 
        , WRONG_ANS
    FROM
        ENTRIES
        INNER JOIN (
            SELECT
                    USER_ID, CONTEST_ID, ENTRY_ID
                    , MAX(AC_AT) AS ENDED_AT
                    , SUM(
                        CASE STATUS
                            WHEN 'AC' THEN 0
                            ELSE 1
                        END) AS WRONG_ANS
                    , SUM(POINT) AS POINT
                FROM
                    SUBMISSIONS
                    INNER JOIN E
                    USING (USER_ID, CONTEST_ID, ENTRY_ID, PROBLEM_ID)
                WHERE
                    SUBMITTED_AT <= AC_AT
                GROUP BY
                    USER_ID, CONTEST_ID, ENTRY_ID
        ) SS
        USING (USER_ID, CONTEST_ID, ENTRY_ID)
     ) B
    WHERE
        POINT > 0
    ORDER BY
        POINT DESC, EX_TIME, USER_ID
提出情報
提出日時2023/02/19 22:08:44
コンテスト第3回 SQLコンテスト
問題順位計算
受験者KAZAMAI_NaruTo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
WA
82 MB