コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
with norm as (
select
E.USER_ID as USER_ID,
S.SUBMIT_ID as SUBMIT_ID,
S.PROBLEM_ID as PROBLEM_ID,
unixepoch(S.SUBMITTED_AT) - unixepoch(E.STARTED_AT) as ELAPSED,
S.STATUS as STATUS,
S.POINT as POINT
from
ENTRIES as E,
SUBMISSIONS as S
where
E.ENTRY_ID == S.ENTRY_ID
and E.CONTEST_ID == 2
),
point_table as (
select
USER_ID,
sum(POINT) as POINT
from
norm
group by
USER_ID
having
POINT > 0
),
ac_time as (
select
USER_ID,
PROBLEM_ID,
max(
case
when STATUS == "AC" then ELAPSED
else null
end
) as AC_TIME
from
norm
group by
USER_ID,
PROBLEM_ID
having
AC_TIME is not null
),
time_table as (
select
USER_ID,
max(AC_TIME) as TIME
from
ac_time
group by
USER_ID
),
wa_table as (
select
A.USER_ID as USER_ID,
count(*) as WA
from
ac_time as A,
norm as N
where
A.USER_ID == N.USER_ID
and A.PROBLEM_ID == N.PROBLEM_ID
and N.ELAPSED < A.AC_TIME
group by
A.USER_ID
)
select
rank() over(
order by
P.POINT desc,
T.TIME + 300 * ifnull(W.WA, 0)
) as RANK,
P.USER_ID as USER_ID,
P.POINT as POINT,
T.TIME + 300 * ifnull(W.WA, 0) as EX_TIME,
ifnull(W.WA, 0) as WRONG_ANS
from
point_table as P
join time_table as T on P.USER_ID == T.USER_ID
left outer join wa_table as W on P.USER_ID == W.USER_ID
order by
RANK,
WRONG_ANS,
USER_ID
提出情報
提出日時 | 2024/02/17 01:54:20 |
コンテスト | 第3回 SQLコンテスト |
問題 | 順位計算 |
受験者 | shogo314 |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
86 MB