コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
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,
sum(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,
user_id
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
order by
RANK,
POINT,
USER_ID
提出情報
提出日時 | 2022/10/20 13:09:26 |
コンテスト | 第3回 SQLコンテスト |
問題 | 順位計算 |
受験者 | taka22 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 80 MB |
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
WA
80 MB