-
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
11-H0ngJu #178
Conversation
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.
from collections import deque
import sys
def input(): return sys.stdin.readline().rstrip()
N = int(input())
board = []
for _ in range(N):
board.append(list(input()))
dx = [0, 0, -1, 1]
dy = [-1, 1, 0, 0]
visited = set()
answer = 1
for col in range(N):
for row in range(N):
for dir in range(4):
new_col = col + dy[dir]
new_row = row + dx[dir]
if new_col < 0 or new_col >= N: continue
if new_row < 0 or new_row >= N: continue
if ((col, row, new_col, new_row)) in visited: continue
if ((new_col, new_row, col, row)) in visited: continue
visited.add(((col, row, new_col, new_row)))
board[col][row], board[new_col][new_row] = board[new_col][new_row], board[col][row]
temp = 0
is_connect = False
for check_col in range(N):
if check_col == col:
is_connect = True
if board[check_col][row] == board[col][row]:
temp+=1
else:
if is_connect:
answer = max(answer, temp)
break
temp=0
if is_connect:
answer = max(answer, temp)
temp = 0
is_connect = False
for check_row in range(N):
if check_row == row:
is_connect = True
if board[col][check_row] == board[col][row]:
temp+=1
else:
if is_connect:
answer = max(answer, temp)
break
temp=0
if is_connect:
answer = max(answer, temp)
temp = 0
is_connect = False
for check_col in range(N):
if check_col == new_col:
is_connect = True
if board[check_col][new_row] == board[new_col][new_row]:
temp+=1
else:
if is_connect:
answer = max(answer, temp)
break
temp=0
if is_connect:
answer = max(answer, temp)
temp = 0
for check_row in range(N):
if check_row == new_row:
is_connect = True
if board[new_col][check_row] == board[new_col][new_row]:
temp+=1
else:
if is_connect:
answer = max(answer, temp)
break
temp=0
if is_connect:
answer = max(answer, temp)
board[col][row], board[new_col][new_row] = board[new_col][new_row], board[col][row]
print(answer)
์ ๋ ๊ทธ๋ฅ ๊ตฌํ์ผ๋ก ํ์์ต๋๋ค!!!
์๋นํ ๊ท์ฐฎ์ ๋ฌธ์ ์๋ค์ ,,,,,,,,,,,,,,,,,
์ฝ๋ ์ ์ฝํ๊ณ ์ข๋ค์,,,
ํ์ฅฌ๋ฅด ํฌํ์ฑ์ฅ ใ ใทใทใท
์ค๋ฒ ๋ฌ์ฑ๋ ์ถํ๋๋ฆฝ๋๋ค...!
# ์ด์์ ๋จน์ ๋ | ||
if data[row][idx] == data[row][idx+1]: | ||
tmp_col += 1 | ||
col_cnt = max(col_cnt, tmp_col) | ||
else: | ||
tmp_col = 1 | ||
|
||
# ํ์์ ๋จน์ ๋ | ||
if data[idx][col] == data[idx+1][col]: | ||
tmp_row += 1 | ||
row_cnt = max(row_cnt, tmp_row) | ||
else: | ||
tmp_row = 1 |
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.
ใ ใ ใ ใ ใ ใ ใ ใ ใ ใ "์ด์์ ๋จน์ ๋"
๐ ๋ฌธ์ ๋งํฌ
์ฌํ ๊ฒ์
โ๏ธ ์์๋ ์๊ฐ
30๋ถ?
โจ ์๋ ์ฝ๋
๋ฌธ์ ํ ์ค ์์ฝ : ๊ฐ์ ์์ ์ฌํ๋ง ๋จน์ ์ ์๋ค๊ณ ํ ๋, ์ธ์ ํ ๋ ์ฌํ์ ๋ฐ๊ฟ์ ๋จน์ ์ ์๋ ์ฌํ์ ์ต๋ ๊ฐ์ ๊ตฌํ๊ธฐ (row ๋ง ๋จน๊ฑฐ๋ col๋ง ๋จน์ด์ผํจ)
๋ฌธ์ ๋ฅผ ์ฝ๊ณ , ๋ฐฐ์ด๋ 50*50์ด๊ณ ,
๋ฑํ ๋ ์ค๋ฅด๋ ๊ฒ ์์ด์ ๊ทธ๋ฅ ๊ตฌํ์ผ๋ก ์ ๊ทผํ์ต๋๋ค.
์๋ ์ฝ๋๋ ๊ฐ๋จํด์ ๋ง๋ถ์ผ ๋ง์ด ์๋ค์ฉ ..?
๋ฐฑ์ค ๋์ด๋๋ ๊ฐ๋ ํ๊ธฐ๊ฐ ์ด๋ ต๊ตฐ์ ..
์๊ณ ๋ฆฌ์ฆ ๋ถ๋ฅ๋ฅผ ๋ณด๋๊น ๊ตฌํ, ๋ธ๋ฃจํธํฌ์ค๋ผ์ ์ด๋ ๊ฒ ์ ๊ทผํ๋๊ฒ ๋ง๋ ๊ฒ ๊ฐ์ต๋๋ค.
ใ .ใ
![image](https://private-user-images.githubusercontent.com/106425326/320270528-9104faef-63b6-4c8a-aaf9-92a5e8cd21e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMDA2NDQsIm5iZiI6MTczOTIwMDM0NCwicGF0aCI6Ii8xMDY0MjUzMjYvMzIwMjcwNTI4LTkxMDRmYWVmLTYzYjYtNGM4YS1hYWY5LTkyYTVlOGNkMjFlOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxNTEyMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYzk1Yjg0MzYzNjFmMTI3MzgyMzFmOWE3MTcwNTQ3MDEwZjUzNGE1ZDgwNmNjMmVlYTY1Njg4YTAxMzVmZTAxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.EdrtEjUAO-otWgWG0MSn3dzPG38ENwId5y6jH69-CGc)
์ด ๋ฌธ์ ํธ๋๊น ๋๋์ด ์ค๋ฒ๊ฐ ๋์๋ค์ฉ ๐๐๐๐
๐ ์๋กญ๊ฒ ์๊ฒ๋ ๋ด์ฉ