Uwi Tenpen
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Zwischenablage
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Reines HTML
Menü Note settings Note Insights Versions and GitHub Sync Sharing URL Create Hilfe
Create Create new note Create a note from template
Menü
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Zwischenablage
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Reines HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Zwischenablage
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # yukicoder No. 1696 Nonnil [問題](https://yukicoder.me/problems/no/1696) ## 概要 次の条件をすべて満たす長さ$N$の数列Aの個数を出力せよ。 - 各要素は$[1,K]$の整数。 - 与えられた$M$個の$(L_i,R_i)$それぞれについて、$[L_i,R_i]$に属するAの要素が必ず存在する。 ## 制約 - $1\le N\le 10^9$ - $1\le K\le 1500$ - $\bmod=998244353$ ## 自分の解法 想定解と同じ計算量だけど、包除を使わず形式的冪級数的な解き方をした。$k$と$K$が紛らわしいかもしれん。 想定解と同様、$[L_i,R_i]$のうち、他の区間を含んでいるようなものは要らないので除いておく。これで残った区間は$O(K)$個になり、始端および終端の値の大小について全順序になる。 いったんすぐに思いつくDPとして、値昇順に走査するもので、 $dp[i][j] =$ (最後に1個以上存在する値が$i$のときに、それまで値が確定した項数が$j$であるvalidなAの個数) というのを考える。すると遷移は $$dp[i][j] = \sum_{(k,l),~l<j} dp[k][l]\binom{N-l}{j-l}$$ となる。ただし$k$は、$[k+1,i-1]$がどの区間も含まないようにする$k$でなければならない。これはすぐに求まる。 最終的に$[i+1,K]$に区間が含まれていないような$dp[i][j]$について、その合計を求めると答えが出る。 よくやる変換として、 $$dp'[i][j] = dp[i][j]\cdot (N-j)!$$ とおき、 $$dp'[i][j] = \sum_{(k,l),~l<j} dp'[k][l]/(j-l)!$$ として、初期値を$dp'[0][0]=N!$ (あるいは1のままで最後に$1/N!$をかける)というふうにできる。 $dp'[i][j]$の値を$x^j$の係数だと思って$dp'[i]$を多項式で表すことにすると、 $$dp'[i] = \sum_k dp'[k]\cdot (x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots )$$ $$dp'[i] = \left(\sum_k dp'[k]\right) (e^x-1)$$ となる。初期値を$e^0$として書けたので、$dp'[i]$は、$e^{ax}$ ($a\in \{0,1,\ldots ,K\}$)の線形和として表せる。この線形和の係数を状態としてDPすれば良い。 $dp'$を求めるにあたり、右辺の$dp'$の和での$k$の走る領域はスライドする区間になるため、ここはしゃくとりで求められる。 よって$O(K^2)$で$dp'[*]$が列挙でき、$[i+1,K]$に区間が含まれていないような$dp'[i]$について、その$x^N$の係数の合計を求めると良い。 計算量は想定解と同じ。 (使ってないけど、$0^n, 1^n, 2^n, \ldots ,K^n$を全列挙するやつをつかうと$O(K\log N)$が$O(K\log N/\log K)$には減りそう) ## コード https://yukicoder.me/submissions/704118

    Importieren aus der Zwischenablage

    Markdown oder Website hier einfügen

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    Diese Notiz ist gesperrt

    Entschuldigung, nur der Besitzer darf die Notiz bearbeiten.

    Limit erreicht

    Entschuldigung, die maximale Länge der Notiz ist erreicht.
    Bitte reduzieren Sie den Inhalt oder nutzen zwei Notizen, danke.

    Aus GitHub Gist importieren

    Aus Snippet importieren

    oder

    Zu Snippet exportieren

    Sind sie sicher?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    Bitte laden Sie die Seite neu

    Ihre Client Version ist nicht mit dem Server kompatibel
    Neu laden zum Updaten.
    Neue Version verfügbar.
    Versionshinweise
    Neu laden für neue Funktionen
    Ihr Nutzerstatus hat sich geändert.
    Neu laden für neuen Nutzerstatus.

    Sign in

    Forgot password

    oder

    By clicking below, you agree to our terms of service.

    Einloggen über Facebook Einloggen über Twitter Einloggen über GitHub Einloggen über Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Hilfe

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Dokumente

    Help & Tutorial

    How to use Book mode

    Beispiel Präsentation

    API Docs

    Edit in VSCode

    Install browser extension

    Kontakte

    Feedback

    Discord

    Kontakt

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Beispiel Reference
    # Überschrift Überschrift 基本排版
    - Stichpunkte
    • Stichpunkte
    1. Nummeriert
    1. Nummeriert
    - [ ] To Do Liste
    • To Do Liste
    > Zitat
    Zitat
    **Fett** Fett
    *Kursiv* Kursiv
    ~~Durchgestrichen~~ Durchgestrichen
    19^th^ 19th
    H~2~O H2O
    ++Unterstrichen++ Unterstrichen
    ==Markiert== Markiert
    [link text](https:// "title") Link
    ![image alt](https:// "title") Foto
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Extern
    $L^aT_eX$ LaTeX
    :::info
    Hinweisfeld
    :::

    Hinweisfeld

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully