회원가입
로그인
Toggle navigation
문제
문제
전체 문제
문제 출처
단계별로 풀어보기
알고리즘 분류
추가된 문제
문제 순위
문제
푼 사람이 한 명인 문제
아무도 못 푼 문제
최근 제출된 문제
최근 풀린 문제
랜덤
출처
ICPC
Olympiad
한국정보올림피아드
한국정보올림피아드시․도지역본선
전국 대학생 프로그래밍 대회 동아리 연합
대학교 대회
카카오 코드 페스티벌
Coder's High
ICPC
Regionals
World Finals
Korea Regional
Africa and the Middle East Regionals
Europe Regionals
Latin America Regionals
North America Regionals
South Pacific Regionals
문제집
대회
채점 현황
게시판
그룹
더 보기
재채점 기록
블로그
도움말
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
시작하자마자 틀리는 이유를 모르겠습니다(반례는 다 통과합니다)
20061번 - 모노미노도미노 2
tkdring3
2년 전
0
아무리 살펴봐도 모르겠습니다...
게시판에 있는 반례는 다 통과합니다.
blocks = [[(0, 0)], [(0, 0), (0, 1)], [(0, 0), (1, 0)]] board = [[[0] * 4 for i in range(6)] for _ in range(2)] print(board) restore = [] score = 0 def drop_block(x, t, board_color): global score if board[board_color][0][x] == 1: return False # check how many steps can go down dist = 0 is_blocked = False while not is_blocked: for r, c in blocks[t]: if board[board_color][r + dist][x + c] == 1: is_blocked = True if dist > 0: dist -= 1 break if not is_blocked: if t == 2: # 세로 블럭은 아래 한칸이 더 있어야되므로 4번 row까지만 체크함 if dist < 4: dist += 1 else: break else: if dist < 5: dist += 1 else: break # place block for r, c in blocks[t]: board[board_color][r + dist][x + c] = 1 # check fullfill row row = 5 while row > 1: is_fullfill = True for c in range(4): if board[board_color][row][c] == 0: is_fullfill = False break if is_fullfill: # remove_row for i in range(row, 0, -1): for j in range(4): board[board_color][i][j] = board[board_color][i - 1][j] # make empty in top row for i in range(4): board[board_color][0][i] = 0 score += 1 else: row -= 1 # check pale colored board row = 1 while row > -1: is_exist = False for c in range(4): if board[board_color][row][c] == 1: is_exist = True break if is_exist: for i in range(5, 0, -1): for j in range(4): board[board_color][i][j] = board[board_color][i - 1][j] for i in range(4): board[board_color][0][i] = 0 else: row -= 1 N = int(input()) while N: N -= 1 t, y, x = map(int, input().split()) t -= 1 drop_block(x, t, 0) # green board if t == 1: t = 2 elif t == 2: t = 1 drop_block(y, t, 1) # blue board cnt = 0 for i in range(6): for j in range(4): if board[0][i][j] == 1: cnt += 1 if board[1][i][j] == 1: cnt += 1 print(score) print(cnt)
댓글을 작성하려면
로그인
해야 합니다.
tkdring3 2년 전
아무리 살펴봐도 모르겠습니다...
게시판에 있는 반례는 다 통과합니다.