ソースコード
select
    rank() over(
        order by
            POINT desc, strftime('%s', MAX_SUBMITTED_AT) - strftime('%s', STARTED_AT) + 300*ifnull(PROBLEM_COUNT.PROBLEM_COUNT, 0)
    ) as RANK,
    USER_ID,
    POINT,
    strftime('%s', MAX_SUBMITTED_AT) - strftime('%s', STARTED_AT) + 300*ifnull(PROBLEM_COUNT.PROBLEM_COUNT, 0) as EX_TIME,
    ifnull(PROBLEM_COUNT.PROBLEM_COUNT, 0) AS WRONG_ANS
from
    ENTRIES
    inner join(
        select
            ENTRY_ID,
            max(SUBMITTED_AT) as MAX_SUBMITTED_AT
        from
            SUBMISSIONS
        where
            STATUS = "AC"
        group by
            ENTRY_ID
    ) as MAX_SUBMITTED_AT on ENTRIES.ENTRY_ID = MAX_SUBMITTED_AT.ENTRY_ID
    inner join(
        select
            ENTRY_ID,
            sum(POINT) as POINT
        from
            SUBMISSIONS
        group by
            ENTRY_ID
    ) as POINT on ENTRIES.ENTRY_ID = POINT.ENTRY_ID
    left join(
        select
            ENTRY_ID,
            count(PROBLEM_COUNT) AS PROBLEM_COUNT
        from
            (
                select
                    SUBMISSIONS.ENTRY_ID,
                    SUBMISSIONS.PROBLEM_ID,
                    count(SUBMISSIONS.PROBLEM_ID) as PROBLEM_COUNT
                from
                    SUBMISSIONS
                    left join(
                        select
                            ENTRY_ID,
                            PROBLEM_ID,
                            max(SUBMITTED_AT) as AC_SUBMITTED_AT
                        from
                            SUBMISSIONS
                        where
                            STATUS = "AC"
                        group by
                            ENTRY_ID,
                            PROBLEM_ID
                    ) as AC_SUBMITTED_AT on SUBMISSIONS.ENTRY_ID = AC_SUBMITTED_AT.ENTRY_ID
                    and SUBMISSIONS.PROBLEM_ID = AC_SUBMITTED_AT.PROBLEM_ID
                where
                    STATUS = "WA"
                    and SUBMITTED_AT < AC_SUBMITTED_AT
                    and AC_SUBMITTED_AT is not null
                group by
                    SUBMISSIONS.ENTRY_ID,
                    SUBMISSIONS.PROBLEM_ID
            )
        group by
            ENTRY_ID
    ) as PROBLEM_COUNT on ENTRIES.ENTRY_ID = PROBLEM_COUNT.ENTRY_ID
where
    CONTEST_ID = 2
    and POINT <> 0
order by
    RANK,
    POINT,
    USER_ID
提出情報
提出日時2022/10/20 02:12:26
コンテスト第3回 SQLコンテスト
問題順位計算
受験者taka22
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
82 MB
データパターン2
WA
89 MB