ソースコード
 WITH AX(n, MONTHLY) AS (
    SELECT
            n, date(MIN_YM, (n - 1) || ' months') AS MONTHLY
        FROM 
            (
                SELECT
                    MIN(MONTHLY) AS MIN_YM
                    , MAX(MONTHLY) AS MAX_YM
                FROM
                    MRR_DATA
            ) MS
            , (
                SELECT
                        ROW_NUMBER() OVER () AS n
                    FROM
                        (VALUES(1),(2),(3),(4),(5),(6)) N1
                        , (VALUES(1),(2),(3),(4),(5),(6)) N2
                        , (VALUES(1),(2),(3),(4),(5),(6)) N3
            ) N
        WHERE
            date(MIN_YM, (n - 1) || ' months') <= MAX_YM
    )
    , MDX(n, monthly, DMRR) AS (
        SELECT
            n
            , monthly
            , COALESCE(
                NEW_MRR
                 + EXPANSION_MRR
                 - DOWNGRADE_MRR
                 - CHURN_MRR
             , 0) AS DMRR
        FROM
            AX
            LEFT OUTER JOIN MRR_DATA
            USING (MONTHLY)
    )
    , X(n, monthly, MRR, DMRR) AS (
        SELECT
            n, monthly
            , 0 AS MRR
            , DMRR
        FROM
            MDX
        WHERE
            n = 1
        UNION ALL
            SELECT
                MDX.n, MDX.monthly, X.MRR + X.DMRR, MDX.DMRR
            FROM
                X
                INNER JOIN MDX
                ON X.n + 1 = MDX.n
        )
SELECT
        monthly, MRR
    FROM
        X
    ORDER BY
        monthly

提出情報
提出日時2023/02/20 00:02:45
コンテスト第5回 SQLコンテスト
問題MRRの集計
受験者KAZAMAI_NaruTo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
78 MB
データパターン3
WA
78 MB