ソースコード

select RANK() OVER ( ORDER BY TMP.POINT DESC ,TMP.EX_TIME asc) as RANK,
       TMP.*
from (select E.USER_ID,
             PO.POINT,
             PO.LAST_SUB - strftime('%s', E.STARTED_AT) + (COALESCE(WA.WACNT, 0) * 300) as EX_TIME,
             COALESCE(WA.WACNT, 0)                                                      as WRONG_ANS

      from ENTRIES E
               inner join(select SUB.ENTRY_ID, sum(POINT) POINT, max(strftime('%s', SUB.SUBMITTED_AT)) as LAST_SUB
                          from SUBMISSIONS SUB
                          where SUB.STATUS = 'AC'
                            and SUB.POINT > 0
                          group by SUB.ENTRY_ID) PO on PO.ENTRY_ID = E.ENTRY_ID

               left join (select SUB.ENTRY_ID, count(*) WACNT
                          from SUBMISSIONS SUB
                                   INNER JOIN
                               (select SUB.ENTRY_ID,
                                       SUB.PROBLEM_ID,
                                       max(SUB.SUBMITTED_AT) SUBMITTED_AT
                                from SUBMISSIONS SUB
                                where SUB.STATUS = 'AC' group by sub.ENTRY_ID, SUB.PROBLEM_ID) AC_TIME
                               ON AC_TIME.ENTRY_ID = SUB.ENTRY_ID
                                   AND AC_TIME.PROBLEM_ID = SUB.PROBLEM_ID
                          where SUB.STATUS <> 'AC'
                            and AC_TIME.SUBMITTED_AT > SUB.SUBMITTED_AT
                          group by SUB.ENTRY_ID) WA
                         on E.ENTRY_ID = WA.ENTRY_ID
      where E.CONTEST_ID = 2) TMP

order by 1, 5, 2;
提出情報
提出日時2022/11/24 19:24:22
コンテスト第3回 SQLコンテスト
問題順位計算
受験者tamurakami
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
WA
79 MB