ソースコード
SELECT
    RANK() OVER(
        ORDER BY
            SUM(POINT) DESC,
            MAX(ACCEPTED_AT) - strftime('%s', STARTED_AT) + 300 * WRONG_ANS ASC
    ) AS RANK,
    USER_ID,
    SUM(POINT) AS POINT,
    MAX(ACCEPTED_AT) - strftime('%s', STARTED_AT) + 300 * WRONG_ANS AS EX_TIME,
    WRONG_ANS
FROM
    ENTRIES
INNER JOIN (
    SELECT
        CONTEST_ID,
        PROBLEM_ID,
        USER_ID,
        A.POINT,
        ACCEPTED_AT,
        COUNT(*) - 1 AS WRONG_ANS
    FROM
        SUBMISSIONS
    INNER JOIN (
        SELECT
            CONTEST_ID,
            PROBLEM_ID,
            USER_ID,
            POINT,
            MIN(strftime('%s', SUBMITTED_AT)) AS ACCEPTED_AT
        FROM
            SUBMISSIONS
        WHERE
            ENTRY_ID IS NOT NULL
            AND STATUS = 'AC'
        GROUP BY
            CONTEST_ID,
            PROBLEM_ID,
            USER_ID
    ) AS A USING (
        CONTEST_ID,
        PROBLEM_ID,
        USER_ID
    )
    WHERE
        ENTRY_ID IS NOT NULL
        AND strftime('%s', SUBMITTED_AT) <= ACCEPTED_AT
    GROUP BY
        CONTEST_ID,
        PROBLEM_ID,
        USER_ID
) USING (
    CONTEST_ID,
    USER_ID
)
WHERE
    CONTEST_ID = 2
GROUP BY
    USER_ID
ORDER BY
    RANK ASC
;
提出情報
提出日時2022/10/19 23:35:27
コンテスト第3回 SQLコンテスト
問題順位計算
受験者ma
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
WA
78 MB