Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new solution document (1110.md) that explains an algorithm for finding pairs (l,r) in an array where the median equals k. The document provides solutions for two different constraints: N ≤ 1000 and N ≤ 1000000, with time complexities of O(N²) and O(N) respectively.
md/1110.md
Outdated
|
|
||
| เมื่อกำหนัด $L_s$ เป็นจำนวน $l$ ที่ทำให้ $SL[l]=s$ และ $R_s$ เป็นจำนวน $r$ ที่ทำให้ $ SR[r] =s$ จะได้ว่าคำตอบคือ $\sum_{s=-N}^N L_sR_{-s}$ (เพราะเมื่อ $SL[l] =s$ และ $ SR[r] =-s$ จะได้ว่า $\Sigma_{i=l}^{x} C[i] + \Sigma_{i=x}^r C[i]= s - s = 0$) | ||
|
|
||
| เราสามารถคำนวณ $L_s$ ได้โดยการไล่คำนวณ $SL[l]$ ทุกตั้งตั้งแต่ $l=x$ ลงไปถึง $l=1$ และเพิ่ม $L_s$ ทุกครั้งที่ $SL[l] = s$ โดยเริ่มจาก $SL[x] = 0$ และคำนวณ $SL[l] = SL[l+1] + C[l]$ สำหรับ $l$ ต่อๆ ไป สามารถใช้วิธีในทำนองเดียวกันในการคำนวณ $R_s$ โดยคำนวณ $SR[r]$ เริ่มจาก $r=x$ ไปจนถึง $r=N$ |
There was a problem hiding this comment.
There's a duplicate word 'ตั้ง' in 'ทุกตั้งตั้งแต่'. It should be 'ทุกตั้งแต่' (from every).
Suggested change
| เราสามารถคำนวณ $L_s$ ได้โดยการไล่คำนวณ $SL[l]$ ทุกตั้งตั้งแต่ $l=x$ ลงไปถึง $l=1$ และเพิ่ม $L_s$ ทุกครั้งที่ $SL[l] = s$ โดยเริ่มจาก $SL[x] = 0$ และคำนวณ $SL[l] = SL[l+1] + C[l]$ สำหรับ $l$ ต่อๆ ไป สามารถใช้วิธีในทำนองเดียวกันในการคำนวณ $R_s$ โดยคำนวณ $SR[r]$ เริ่มจาก $r=x$ ไปจนถึง $r=N$ | |
| เราสามารถคำนวณ $L_s$ ได้โดยการไล่คำนวณ $SL[l]$ ทุกตั้งแต่ $l=x$ ลงไปถึง $l=1$ และเพิ่ม $L_s$ ทุกครั้งที่ $SL[l] = s$ โดยเริ่มจาก $SL[x] = 0$ และคำนวณ $SL[l] = SL[l+1] + C[l]$ สำหรับ $l$ ต่อๆ ไป สามารถใช้วิธีในทำนองเดียวกันในการคำนวณ $R_s$ โดยคำนวณ $SR[r]$ เริ่มจาก $r=x$ ไปจนถึง $r=N$ |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
MasterIceZ
requested changes
Aug 6, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rendering : 1110_render.pdf