ソースコード
SELECT
    (SELECT COUNT(*) FROM SUBMISSIONS WHERE SUM(SUBMISSIONS.POINT) > SUM(S.POINT)
        AND S.USER_ID = SUBMISSIONS.USER_ID AND SUBMISSIONS.CONTEST_ID = 2 GROUP BY SUBMISSIONS.USER_ID) + 1 RANK
    ,S.USER_ID
    ,SUM(S.POINT) POINT
    ,(MAX(S.SUBMITTED_AT) - E.STARTED_AT + IFNULL(300 * 
        (SELECT COUNT(*) FROM SUBMISSIONS S1
            ,(SELECT PROBLEM_ID, USER_ID, MIN(SUBMITTED_AT) MIN
            FROM SUBMISSIONS
            WHERE STATUS = 'AC' AND CONTEST_ID = 2
            GROUP BY PROBLEM_ID ,USER_ID) S2
        WHERE S.ENTRY_ID = S1.ENTRY_ID
           AND S.CONTEST_ID = S1.CONTEST_ID
           AND S1.CONTEST_ID = 2
           AND S1.PROBLEM_ID = S2.PROBLEM_ID
           AND S1.USER_ID = S2.USER_ID
           AND S1.STATUS <> 'AC'
           AND S1.SUBMITTED_AT < S2.MIN
        GROUP BY S1.USER_ID
       ), 0)) EX_TIME
    ,(SELECT COUNT(*) FROM SUBMISSIONS S1
            ,(SELECT PROBLEM_ID, USER_ID, MIN(SUBMITTED_AT) MIN
            FROM SUBMISSIONS
            WHERE STATUS = 'AC' AND CONTEST_ID = 2
            GROUP BY PROBLEM_ID ,USER_ID) S2
        WHERE S.ENTRY_ID = S1.ENTRY_ID
           AND S.CONTEST_ID = S1.CONTEST_ID
           AND S1.CONTEST_ID = 2
           AND S1.PROBLEM_ID = S2.PROBLEM_ID
           AND S1.USER_ID = S2.USER_ID
           AND S1.STATUS <> 'AC'
           AND S1.SUBMITTED_AT < S2.MIN
        GROUP BY S1.USER_ID
        ) WRONG_ANS
FROM
    SUBMISSIONS S
    INNER JOIN ENTRIES E
        ON E.ENTRY_ID = S.ENTRY_ID
           AND E.CONTEST_ID = S.CONTEST_ID
           AND E.CONTEST_ID = 2
WHERE
    POINT <> 0
GROUP BY
    S.USER_ID
ORDER BY
    RANK
    ,WRONG_ANS
    ,S.USER_ID
提出情報
提出日時2022/10/19 19:02:22
コンテスト第3回 SQLコンテスト
問題順位計算
受験者nanana
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量96 MB
メッセージ
SQLITE_ERROR: misuse of aggregate: SUM()
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
96 MB
データパターン2
RE
96 MB