ソースコード
select rank() over(
    order by
        POINT desc
) as RANK,
USER_ID,
POINT,
strftime('%s', MAX_SUBMITTED_AT) - strftime('%s', STARTED_AT) 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
        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 01:48:49
コンテスト第3回 SQLコンテスト
問題順位計算
受験者taka22
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
85 MB