ソースコード

SELECT 
    RANK() OVER (ORDER BY MAIN.SUM_POINT DESC) AS RANK,
    MAIN.USER_ID,
    MAIN.SUM_POINT,
    MAIN.EX_TIME,
    MAIN.WRONG_ANS
FROM (
SELECT
    -- RANK,
    SUB.USER_ID,
    SUM(SUB.POINT) AS SUM_POINT,
    -- EX_TIME,
    MAX(strftime('%s', SUB.SUBMITTED_AT)) - strftime('%s', ENTRY.STARTED_AT) AS EX_TIME,
    COUNT(CASE WHEN SUB.STATUS = 'AC' THEN 0 ELSE 1 END) AS WRONG_ANS
FROM SUBMISSIONS AS SUB
INNER JOIN ENTRIES AS ENTRY
ON ENTRY.ENTRY_ID = SUB.ENTRY_ID
AND ENTRY.CONTEST_ID = SUB.CONTEST_ID
AND ENTRY.USER_ID = SUB.USER_ID
WHERE SUB.CONTEST_ID = 2
-- AND SUB.STATUS = 'AC'
AND strftime('%s', SUB.SUBMITTED_AT) - strftime('%s', ENTRY.STARTED_AT) <= 86400
GROUP BY SUB.USER_ID
HAVING SUM(SUB.POINT) > 0
AND MAX(strftime('%s', SUB.SUBMITTED_AT)) - strftime('%s', ENTRY.STARTED_AT) < SUB.SUBMITTED_AT
) AS MAIN
ORDER BY MAIN.SUM_POINT DESC
;
提出情報
提出日時2022/10/19 23:29:36
コンテスト第3回 SQLコンテスト
問題順位計算
受験者h03a081b
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
87 MB