-
Notifications
You must be signed in to change notification settings - Fork 0
1-sep037 #6
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
1-sep037 #6
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| ## βοΈ κΈ°λ‘ | ||
| ## βοΈ κΈ°λ‘ | ||
|
|
||
| <img width="498" alt="αα ³αα ³α α ΅α«αα £αΊ 2025-04-05 14 43 30" src="https://github.com/user-attachments/assets/6acb9b5b-e94a-46e8-9b5c-529cdd282bd8" /> | ||
|
|
||
|
|
||
| | μ°¨μ | λ μ§ | λ¬Έμ μ ν | λ§ν¬ | νμ΄ | | ||
| |:----:|:---------:|:----:|:-----:|:----:| | ||
| | 1μ°¨μ | 2024.10.01 | ꡬν | [μΆμ΅ μ μ](https://school.programmers.co.kr/learn/courses/30/lessons/176963)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/35| | ||
| | 1μ°¨μ | 2025.04.05 | ꡬν | [μ«μ μ μ¬κ°ν](https://www.acmicpc.net/problem/1051)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/6| | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // | ||
| // main.swift | ||
| // 1051 | ||
| // | ||
| // Created by Seungeun Park on 4/5/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| let firstLine = readLine()!.split(separator: " ").map {Int($0)!} | ||
| let n = firstLine[0] // ν | ||
| let M = firstLine[1] // μ΄ | ||
|
|
||
| var grid: [[Int]] = [] // μΆκ°ν΄μΌ νλκΉ var | ||
| for _ in 0..<n { // μ€λ‘ μ λ ₯ λ°μ 2μ°¨μ λ°°μ΄ λ§λ€κΈ° | ||
| let row = readLine()!.map {Int($0)!} // μ΄κ³³μ΄ λ°λ‘ λ¬Έμ μ λΆλΆ ! | ||
| grid.append(row) | ||
| } | ||
|
|
||
| func largestSquare(grid: [[Int]]) -> Int { | ||
| let n = grid.count | ||
| let m = grid[0].count | ||
| var maxLength = 1 | ||
|
Comment on lines
+20
to
+23
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ν¨μλ‘ λ§λ 건 μ’μλ° μ΄λΆλΆμμ μ°¨λΌλ¦¬ λ§€κ°λ³μλ‘ λ°κ±°λ mainμμ νΈλκ² μκ°λ³΅μ‘λκ° λΉ‘λΉ‘ν λ¬Έμ μμλ μ’μ κ² κ°μμ!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 볡μ‘λ κ΄λ ¨ν΄μ νμ ν¨μ¨μ μΈ μ½λ μ§λ κ² μ΄λ €μ΄ κ² κ°μμ π₯Ή |
||
|
|
||
| for i in 0..<n { | ||
| for j in 0..<m { | ||
| for k in 1..<min(n-i, m-j){ // λ°°μ΄ λ²μ΄λλ©΄ μλλκΉ !μ΅μνμ μ μ¬κ°ν ν¬κΈ° μ‘κΈ° | ||
| let a = grid[i][j] | ||
| let b = grid[i][j+k] | ||
| let c = grid[i+k][j] | ||
| let d = grid[i+k][j+k] | ||
| // κ° κΌμ§μ μ μλ μ«μ λ΄κΈ° | ||
|
|
||
| if a == b && a == c && a == d { // λ€ νμΈνκΈ° | ||
| maxLength = max(maxLength, (k+1)*(k+1)) // μ 1μ λνλλ©΄ λ³μ κΈΈμ΄κ° 2μΌ λ, μ«μλ 3κ°κ° μμ ! | ||
| /* | ||
| 1 1 1 | ||
| 1 1 1 | ||
| 1 1 1 | ||
| λ³μ κΈΈμ΄κ° 2μ¬λ μ«μλ 3κ° μμ΄μ ,, | ||
| */ | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return maxLength | ||
| } | ||
|
Comment on lines
+25
to
+47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ€ κΈλ‘λ ! μ΅μ ν¬κΈ°λΆν° νμ ¨κ΅°μ. μ λ μ¬μ€ μ μ¬κ°νμ μμλ΄λκ² μ½μ§μμμ μ΄λ°μμ μλ€κ°, μ μΌ ν°κ²μμλΆν° 체ν¬νλ©΄μ λ΄λ €μ€λ©΄ μ΄λ¨κΉν΄μ νμ΄μ¬ μ½λμ΄κΈ΄ νμ§λ§, λ¨Όμ μ μ¬κ°νμ΄ λλ €λ©΄ νκ³Ό μ΄μ€μμ λ μμ μ«μ λ°μ΄ λ μμ μ«μνλ©΄ κ·Έκ² μλ§ μ μ¬κ°ν λ³μ μ΅κ³ μμΉμ§μμκΉ? κ±°κΈ°μλΆν° λμ΄κ΅¬ν΄μ κ³μ κ°±μ ν΄λκ°λ©΄ λκ° λΉ¨λ¦¬ λμ€μ§ μμκΉ? ν΄μ νλλ° μλ§ κ²°κ΅μ μνμΌλ‘ ꡬνμ ν΄μ μ΄μ°¨νΌ 첫λ²μ§Έκ° κ°μ₯ ν°κ±°λΌλ©΄ μλ«κ²λ€μ λΉκ΅νμ§ μλλ€λ©΄ μ΄λ¨κΉ μΆλ€μ. λμ½ ... μ¬μ΄ λ¬Έμ λΌκ³ νμ§λ§ μ νν μ΄λ €μ λλ° μ λ§ κ°κΈΈμ΄ λ©κ΅°μ.. μΈλ±μ€ μ₯λκ³Ό λ§μ§λ§ forλ¬Έμ λ³κΈΈμ΄ μΈ‘μ μ΄ μμ΄λμ΄ λμΆμ΄ λ§μ΄ μ΄λ €μ λ€μ ...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μμ² κΉλνκ² μνΈμ
¨λ€μ ! import Foundation
func solution(_ N: Int, _ M: Int, _ graph: [[Int]]) -> Int {
let LEN = min(N, M)
for width in stride(from: LEN - 1, to: 0, by: -1) {
for i in 0 ..< N - width {
for j in 0 ..< M - width {
let standard = graph[i][j]
if standard == graph[i][j + width] {
if standard == graph[i + width][j] && standard == graph[i + width][j + width] {
return (width + 1) * (width + 1)
}
}
}
}
}
return 1
}
// μ§λλ²μ μ
λ ₯λ°μ λΆλΆ μ¬νμ©
let NM = readLine()!.split(separator: " ").map { Int($0)! }
let N = NM[0]
let M = NM[1]
var arr: [[Int]] = []
for _ in 0 ..< N {
arr.append(readLine()!.map { Int(String($0))! })
}
print(solution(N, M, arr))
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ν μ μ
λ ₯λ°κΈ° μ΅λνμ 건κ°μ μ n, mλ§ λ°λλ‘ νλλ° νμ²λΌνλκ² ν¨μ μλκ° λͺ
νν΄μ§λ κ² κ°λ€μ. μ λ°°μ°κ³ κ°λλ€^^ func solution(_ n: Int, _ m: Int) -> Int {
// μλ΅
let nm = readLine()!.split(separator: " ").map { Int($0)! }
let n = nm[0]
let m = nm[1]
print(solution(n, m))
Comment on lines
+25
to
+47
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ λ λ°λ―Έμμ΄λ λΉμ·ν μ§λ¬ΈμΈλ° μμ κ²λΆν° 체ν¬νμ μ΄μ κ° μμκΉμ?? μ λ λ¬Έμ λ³΄κ³ λ± ν°κ±°λΆν° μ²΄ν¬ ν΄μΌκ² λ€κ³ μκ°μ΄ λ€μκ±°λ©μ. μ κ° ν° κ±°λΆν° μ°Ύμ μ΄μ λ λ¬Έμ μμ 'κ°μ₯ ν° μ μ¬κ°ν'μ μ°ΎμΌλΌκ³ ν΄μμμ.(λ¨μ)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ν κ·Έλ°κ°μ ..! μ λ μμ κ²λΆν° μ°Ύμμ λ ν° κ² μμ λκΉμ§ μ°ΎμΌλ €κ³ κ·Έλ₯ λ°λ‘ μκ°μ΄ λ€μλλ° ν° κ²λΆν° κ°λ κ±Έλ‘λ ν λ² νμ΄λ΄μΌκ² μν¨ |
||
|
|
||
| print(largestSquare(grid: grid)) | ||
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.
μ¬κΈ° λΆλΆ μ€λ₯ μλμλμ??
Int()λ String νμ λ§ λ°μ μ μλλ°, map()μ΄λ compactMap()μ Stringμ λ°κ³ κ° λ¬Έμλ₯Ό Characterλ‘ λ΄μ
μ΄λ₯Ό StringμΌλ‘ λ³νμ νμ§ μμΌλ©΄ Int()λ‘ λνμ΄ μλλκ±Έλ‘ μκ³ μμ΄μμ!!
λμ§ νκ³ λλ €λ΄€λλ° μ λ μ€λ₯κ° λ¨λ€μ..?? λ²μ λ§λ€ μ°¨μ΄κ° μλμ μ΄κ±°.. μμλλΆ.. γ γ
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.
ν μ΄κ±° μ κ° μλͺ» μ¬λ Έμ΄μ
λ°±μ€μλ μ λ κ² νμ΄λκ³ γ γ γ γ
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.
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.
μ΄λ €μ‘
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.
@sep037 κ·Έλ κ΅°λ¨ γ γ γ κ΅Ώκ΅Ώ!!