ソースコード
select
	RANK() OVER(ORDER BY sum_point DESC) as RANK
	,t1.USER_ID as USER_ID
	,sum_point as POINT
	,EX_TIME as EX_TIME
	,WRONG_ANS as WRONG_ANS
from 
	(
	select
		USER_ID
		,sum(POINT) as sum_point
	from 
		SUBMISSIONS
	where 
		CONTEST_ID = 2
	group by
		USER_ID
	) t1
left join (
    select
    	t1.USER_ID
    	--,max_sub_at
    	--,t2.STARTED_AT
    	,strftime('%s', max_sub_at) - strftime('%s', t2.STARTED_AT) as EX_TIME
    from 
    	SUBMISSIONS  t1
    left join ENTRIES   t2
    	on t1.CONTEST_ID = t2.CONTEST_ID
    	and t1.USER_ID = t2.USER_ID
    inner join (
        select
        	USER_ID
        	,max(SUBMITTED_AT) as max_sub_at
        from 
        	SUBMISSIONS
        where 
        	CONTEST_ID = 2
        	and STATUS = 'AC'
        group by 
            USER_ID
        ) t3
        on t1.USER_ID = t3.USER_ID
        and t1.SUBMITTED_AT = t3.max_sub_at
    where 
    	t1.CONTEST_ID = 2
    	and t1.STATUS = 'AC'
    order by 
        t1.USER_ID
    ) t2
    on t1.USER_ID = t2.USER_ID
left join (
	select
		USER_ID
		,count(POINT) as WRONG_ANS
	from 
		SUBMISSIONS
	where 
		CONTEST_ID = 2
		and STATUS <> 'AC'
	group by
		USER_ID
    ) t3
    on t1.USER_ID = t3.USER_ID
order by 
	RANK
	,WRONG_ANS
	,t1.USER_ID
提出情報
提出日時2022/10/20 11:35:09
コンテスト第3回 SQLコンテスト
問題順位計算
受験者sato
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
100 MB
データパターン2
WA
95 MB