ソースコード
WITH ContestData AS (
    SELECT
        e.USER_ID,
        MAX(s.SUBMITTED_AT) AS LastACSubmissionTime,
        COUNT(DISTINCT s.PROBLEM_ID) AS WrongAttempts,
        SUM(s.POINT) AS TotalPoints
    FROM
        ENTRIES e
    LEFT JOIN
        SUBMISSIONS s ON e.ENTRY_ID = s.ENTRY_ID AND s.STATUS = 'AC'
    WHERE
        e.CONTEST_ID = 2
    GROUP BY
        e.USER_ID
)

SELECT
    ROW_NUMBER() OVER (ORDER BY TotalPoints DESC, (strftime('%s', cd.LastACSubmissionTime) - strftime('%s', e.STARTED_AT) + 300 * cd.WrongAttempts) ASC, cd.USER_ID ASC) AS RANK,
    e.USER_ID,
    cd.TotalPoints AS POINT,
    strftime('%s', cd.LastACSubmissionTime) - strftime('%s', e.STARTED_AT) + 300 * cd.WrongAttempts AS EX_TIME,
    cd.WrongAttempts AS WRONG_ANS
FROM
    ContestData cd
JOIN
    ENTRIES e ON cd.USER_ID = e.USER_ID
WHERE
    cd.TotalPoints > 0
ORDER BY
    RANK;
提出情報
提出日時2023/12/17 09:54:21
コンテスト第3回 SQLコンテスト
問題順位計算
受験者za_consul
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
86 MB