회원가입
로그인
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
글쓰기
질문 도움말
자주묻는 질문
왜 틀렸을까요
14499번 - 주사위 굴리기
bimbyam
2년 전
0
다 맞게 푼 거 같은데 틀렸다니까 이유를 모르겠네요...
# https://www.acmicpc.net/problem/14499 # 골드4: 주사위 굴리기 # 세로, 가로, x좌표, y좌표, 명령 개수 n, m, x, y, k = map(int, input().split()) graph = [list(map(int, input().split())) for _ in range(n)] orders = list(map(int, input().split())) dice = [0, [0, 0, 0], 0, 0] # 윗면 dices[1][1] def changeDice(ny, nx): if graph[ny][nx] == 0: graph[ny][nx] = dice[3] else: dice[3] = graph[ny][nx] graph[ny][nx] = 0 def moveNorth(): # 북 moved_1 = dice[0] dice[0] = dice[1][1] dice[1][1] = dice[2] dice[2] = dice[3] dice[3] = moved_1 def moveSouth(): # 남 moved_1 = dice[2] dice[2] = dice[1][1] dice[1][1] = dice[0] dice[0] = dice[3] dice[3] = moved_1 def moveWest(): # 서 moved_1 = [dice[1][1], dice[1][2], dice[3]] moved_2 = dice[1][0] dice[1] = moved_1 dice[3] = moved_2 def moveEast(): # 동 moved_1 = [dice[3], dice[1][0], dice[1][1]] moved_2 = dice[1][2] dice[1] = moved_1 dice[3] = moved_2 # 동, 서, 북, 남 dx = [1, -1, 0, 0] dy = [0, 0, -1, 1] for i in orders: ny = y + dy[i - 1] nx = x + dx[i - 1] if not (0 <= ny < n and 0 <= nx < m): continue if i == 1: # 동 moveEast() elif i == 2: # 서 moveWest() elif i == 3: # 북 moveNorth() elif i == 4: # 남 moveSouth() changeDice(ny, nx) y, x = ny, nx print(dice[1][1])
댓글을 작성하려면
로그인
해야 합니다.
bimbyam 2년 전
다 맞게 푼 거 같은데 틀렸다니까 이유를 모르겠네요...