ソースコード
    SELECT
    	 RANK () OVER(
    		ORDER BY Result.TOTAL DESC, Result.Elapsed + (5 * Result.WC), Result.WC
    	 ) RANK
    	,Result.User_ID USER_ID
    	,Result.TOTAL AS POINT
    	,Result.Elapsed + (5 * Result.WC) AS EX_TIME
    	,Result.WC AS WRONG_ANS
    FROM
    (
    select
    	S.User_ID AS User_ID
    	 ,SUM(
    		CASE	
    			WHEN S.Status <> 'AC' AND Submitted_at < EX_TIME_T.Last_AC_Submitted_Time THEN 1
    			ELSE 0
    		END
    	 ) AS WC
    	, SUM(
    		CASE
    			WHEN	
    				S.Status = 'AC' THEN S.POINT
    			ELSE 0
    		END) AS TOTAL
    	,EX_TIME_T.Elapsed
    FROM
    	Entries E
    INNER JOIN
    	SubMissions S
    INNER JOIN
    (
    select
    	 ROUND( (JULIANDAY(MAX(S.Submitted_at)) -  JULIANDAY(E.Started_at)) * 86400) Elapsed
    	 ,E.User_ID User_ID
    	,MAX(S.Submitted_at) Last_AC_Submitted_Time
    FROM
    	Entries E
    INNER JOIN
    	SubMissions S
    ON
    	E.Entry_ID = S.Entry_ID
    WHERE
    	Status = 'AC'
    AND
    	S.CONTEST_ID = '2'
    GROUP BY
    	E.User_ID
    ) EX_TIME_T
    ON
    	E.Entry_ID = S.Entry_ID
    AND
    	S.User_ID = EX_TIME_T.User_ID
    WHERE
    	S.CONTEST_ID = '2'
    GROUP BY 
    	S.User_ID
    ) Result
    ORDER BY
    	RANK, WRONG_ANS, User_ID
    ;
提出情報
提出日時2022/10/20 09:07:01
コンテスト第3回 SQLコンテスト
問題順位計算
受験者Kojiron
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量93 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
91 MB
データパターン2
WA
93 MB