Eric
    • 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
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw 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 Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # debug ### 採雷重點 1. size()的返回值不能做運算 (x) l.size()-r.size() 3. 如果要做位元運算把(1<<40)放入long long裡,要把1改成1LL,因為只有數字的話型別為int 4. 如果要把int運算完後的值放到long long裡要轉型=> ans=(long long)a*b 5. runtime error!=TLE,可能為陣列越界,除0,非法記憶體存取,stack overflow 6. 寫這樣比較快 變數名稱.lower_bound(要找的value); 7. 有些資料結構要用multiset 必免重覆元素被覆蓋掉 8. 初始化mi要用INT_MAX or LLONG_MAX,1e9有可能不夠大 9. 能不用初始化就不用memset,避免TLE,或改為在讀測資的時候順便初始化 10. 位元運算的優先程度很低,所以只要有關位元運算都要括號 12. 特殊資料結構(set,pq)有時不一定比vector+sort好 13. 陣列用到超過邊界的格子不會提示,要自己注意邊界 14. 如果陣列要開3*10^6話就不要define int long long,不然會開不下 15. STL存取元素的數量都有上限,超過會爆,盡量用陣列取代 16. 如果整數型態是long long的話要改成printf("%lld") 17. 浮點數沒有顯示出來的位數不代表是0,盡量不要直接賦值上去,改為賦值算式上去 18. 有多組測資時要記得初始化!! 19. 狀態轉移初始化時,不合法的狀態要設為inf 20. 能不用map去做映射就不要用,用一般陣列計數就好,否則有可能會TLE 21. 線段樹寫if(Lb <= l && r <= Rb) return seg[node]; 比 if((l == Lb && r == Rb) || l==r) return seg[node]; 快 22. 在函式中交換值時,要記得用&取本尊 23. 陣列最大值要注意!!!很重要!!!有可能會TLE 24. 線段樹在query中的回傳值,要注意狀態,要跟built的狀態一樣,相乘就要記得是相乘 25. 元素相乘取餘數不可蓋前綴和,如果元素相乘沒有取餘數可以蓋前綴和,區間[l,r]=pre[r]/pre[l-1] 26. 二分搜時要注意右界大小,有可能(l+r)時溢位,或太小沒搜到答案 27. 函數pow會回傳浮點數,如果後面有運算式都會變成浮點數運算,輸出時要注意型態,免得cout顯示科學記號而WA 28. vector int mp[MAXN],盡量開在globle,否則可能會seg fault 29. 變數沒用到的就不要宣告,免得mid打成m卻不知道錯哪 30. 次方不能取模 31. define ing long long時,1要寫1LL 32. 數值相減時要注意大減小才會是絕對值 33. 拓譜排序時,node放進去queue的條件為if(- -task[now]==0),注意"==0" 34. dp top-down時初始化要為-1,避免TLE 35. priority_queue TLE時可以改用單調對列(deque)優化 36. struct的空間比較大,MLE時可以考慮把裡面的元素拆出來各自宣告 37. 線段樹要開到SIZE*4才夠用 38. 負數區間取mid要用l+(r-l)/2 39. 李超線段樹動態開點查詢時如果是NULL要返回-INF 40. 計數的變數不能取模 41. 宣告太大的陣列會耗太多時間,可能導致TLE 42. 當題目有取餘數時,要記得先+mod再%mod,避免出現負數 43. long long 位運算要記得用1ll 44. 變數有可能減到負數的情況下,不能使用while(variable),會TLE 45. 巢狀迴圈遍歷的變數不能一樣,否則會衝突 46. C的FIFO讀檔有坑,結尾可能有兩個字元

    Import from clipboard

    Paste your markdown or webpage here...

    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.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    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.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

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

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

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

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    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