ソースコード
WITH AC_SUB AS(
SELECT
    PROBLEM_ID
    ,USER_ID
    ,SUBMITTED_AT AS AC_SUB_TIME
FROM SUBMISSIONS
WHERE CONTEST_ID = '2' AND STATUS = 'AC' AND ENTRY_ID IS NOT NULL
)
SELECT
    RANK() OVER(ORDER BY SUM(POINT) DESC, STRFTIME('%s', MAX(SUBMITTED_AT)) - STRFTIME('%s', t3.STARTED_AT) + 300 *SUM(CASE WHEN t1.STATUS = 'WA' THEN 1 ELSE 0 END)) AS RANK
    ,t1.USER_ID AS USER_ID
    ,SUM(POINT) AS POINT
    ,STRFTIME('%s', MAX(SUBMITTED_AT)) - STRFTIME('%s', t3.STARTED_AT) + 300 *SUM(CASE WHEN t1.STATUS = 'WA' THEN 1 ELSE 0 END) AS EX_TIME
    ,SUM(CASE WHEN t1.STATUS = 'WA' THEN 1 ELSE 0 END) AS WRONG_ANS
FROM SUBMISSIONS t1
INNER JOIN AC_SUB t2
ON t1.PROBLEM_ID = t2.PROBLEM_ID AND t1.USER_ID = t2.USER_ID AND t1.SUBMITTED_AT <= t2.AC_SUB_TIME
INNER JOIN ENTRIES t3
ON t1.ENTRY_ID = t3.ENTRY_ID
WHERE t1.CONTEST_ID = '2' AND t1.ENTRY_ID IS NOT NULL
GROUP BY t1.USER_ID
ORDER BY RANK, WRONG_ANS, USER_ID
提出情報
提出日時2023/02/21 23:06:56
コンテスト第3回 SQLコンテスト
問題順位計算
受験者mott
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量79 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
79 MB
データパターン2
WA
78 MB