-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
61 9kyo hwang #214
Merged
Merged
61 9kyo hwang #214
Conversation
This file contains 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
mjj111
approved these changes
Sep 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ¬Έμ λ₯Ό μ΄ν΄νμ§ λͺ»νλ€κ° μμ μ€λͺ
νμ°Έμ λ³΄κ³ ...
μ΄ν΄νλ νννλ€μ γ
γ
γ
γ
γ
γ
def solution(Data, Col, RowBegin, RowEnd):
# Colλ²μ§Έ κ°μ΄ κ°μΌλ©΄ 첫 λ²μ§Έ κ°μΌλ‘ λ΄λ¦Όμ°¨μ, μλλ©΄ Colλ²μ§Έ κ°μΌλ‘ μ€λ¦μ°¨μ
Data.sort(key=lambda x: (x[Col - 1], -x[0]))
answer = 0
for i in range(RowBegin, RowEnd + 1):
tmp_sum = 0
for val in Data[i-1] :
tmp_sum += val % i
answer ^= tmp_sum
return answer
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.
π λ¬Έμ λ§ν¬
ν μ΄λΈ ν΄μ ν¨μ
βοΈ μμλ μκ°
15λΆ
β¨ μλ μ½λ
1. λ¬Έμ
2μ°¨μ νλ ¬λ‘ ννλλ ν μ΄λΈμ΄ μ£Όμ΄μ§λ€. κ°κ°μ μ΄μ 컬λΌ, νμ ννμ λνλ΄λ©°, 첫 λ²μ§Έ 컬λΌμ λͺ¨λ ννμ λν΄ κ·Έ κ°μ΄ μ€λ³΅λμ§ μλλ‘ λ³΄μ₯λλ€.
μ΄ ν μ΄λΈμ λν ν΄μ ν¨μλ₯Ό λ€μκ³Ό κ°μ΄ μ μνλ€.
col
,row_begin
,row_end
λ₯Ό μ λ ₯λ°λλ€.col
λ²μ§Έ μ»¬λΌ κ° κΈ°μ€μΌλ‘ μ€λ¦μ°¨μ μ λ ¬νλ€. λ¨, κ·Έ κ°μ΄ λμΌν κ²½μ° κΈ°λ³Έν€μΈ 첫 λ²μ§Έ μ»¬λΌ κ°μ κΈ°μ€μΌλ‘ λ΄λ¦Όμ°¨μ μ λ ¬νλ€.row_begin
row_end
μΈ λͺ¨λν μ΄λΈμ ν΄μ κ°μ returnνλΌ.
μ ν μ¬ν
data
κΈΈμ΄data
μ μμ κΈΈμ΄data[i][j]
data[i][j]
λdata
μ μμ κΈΈμ΄row_begin
row_end
data
κΈΈμ΄2. νμ΄
λ¬Έμ μμ μ€λͺ ν λλ‘ κ΅¬ννλ©΄ λλ μ¬μ΄ λ¬Έμ μ΄λ€.
νν μ λ ¬
col
λ²μ§Έ μ»¬λΌ κ°μ΄ λμΌνλ€λ©΄ κΈ°λ³Έν€μΈ 첫 λ²μ§Έ μ»¬λΌ κ°μ κΈ°μ€μΌλ‘ λ΄λ¦Όμ°¨μμ, μλλΌλ©΄ ν΄λΉ κ°μ κΈ°μ€μΌλ‘ μ€λ¦μ°¨μ μ λ ¬νλ€.col - 1
μ κΈ°μ€μΌλ‘ μ‘λλ€.μ°λ¦¬κ° νμν 건$S_i$ κ°μ΄κΈ° λλ¬Έμ νμ λνλ΄λ $S_i$ μ κ°μ iλ²μ§Έ ν νν κ°λ€μ μ΄μ©ν΄ ꡬνλ€.
row_begin
,row_end
ν 컬λΌμi
μ κ°μrow_begin
,row_end
λ‘ μ ννλ€.κ·Έ ν λ¬Έμ μμ μ€λͺ ν λλ‘
row_begin
,row_end
λν 1λΆν° μμμ΄κΈ° λλ¬Έμ μ΄μ μν₯μ λ°μ i λν 1λΆν° μμνκ² λλ€.i - 1
μ΄λ€.ν΄μκ°μ μ΄λ κ² κ΅¬ν$S_i$ κ°λ€μ λμ XORν κ²μΌλ‘ μ μνμΌλ―λ‘
HashVal
μ κ³μν΄μ^=
ν΄μ€λ€.μ΄λ κ² κ΅¬ν
HashVal
κ°μ λ°νν΄μ£Όλ©΄ μμ±μ΄λ€.μ 체 μ½λ
π μλ‘κ² μκ²λ λ΄μ©
μ νλ‘κ·Έλλ¨Έμ€ λ 벨 2 μ νΌ λ¬Έμ λ€ νκ³ μλλ°, νμ€ν λμ΄λ μ°¨μ΄κ° μ’ μ¬νλ€μ.
μμμΌμ νΌ κ²λ λ 벨 2μΈλ°...