ソースコード
select
  RANK() OVER (
    order by
      d.POINT desc,
      d.EX_TIME asc
  ) AS RANK,
  d.USER_ID as USER_ID,
  d.POINT as POINT,
  d.EX_TIME as EX_TIME,
  d.WRONG_ANS as WRONG_ANS
from 
(select
  c.USER_ID as USER_ID,
  a.SUM_POINT as POINT,
  a.MAX_AT - strftime('%s', c.STARTED_AT) + 300*b.WA as EX_TIME,
  b.WA as WRONG_ANS

from
  (select
    ENTRY_ID,
    max(strftime('%s', SUBMITTED_AT)) as MAX_AT,
    sum(POINT) as SUM_POINT
  from
    SUBMISSIONS
  where
    ENTRY_ID is not null and
    CONTEST_ID = 2 and
    STATUS = 'AC'
  group by
    ENTRY_ID) a,

  (select
    ENTRY_ID,
    count(SUBMIT_ID) as WA
  from
    SUBMISSIONS s1
  where
    ENTRY_ID is not null and
    CONTEST_ID = 2 and
    STATUS = 'WA' and
    exists(
      select 1 from SUBMISSIONS s2
      where
        s1.ENTRY_ID = s2.ENTRY_ID and
        s1.PROBLEM_ID = s2.PROBLEM_ID and
        s2.STATUS = 'AC'
    )
  group by
    ENTRY_ID) b,

  ENTRIES c

where
  c.ENTRY_ID = a.ENTRY_ID and
  c.ENTRY_ID = b.ENTRY_ID and
  a.SUM_POINT > 0
order by
  POINT desc,
  EX_TIME asc) d

order by
  RANK asc,
  WRONG_ANS asc,
  USER_ID asc
提出情報
提出日時2022/10/19 23:08:01
コンテスト第3回 SQLコンテスト
問題順位計算
受験者ks2m
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量108 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
87 MB
データパターン2
WA
108 MB