회원가입
로그인
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
글쓰기
질문 도움말
자주묻는 질문
테케는 전부 통과인데...
14891번 - 톱니바퀴
smpa6379
2년 전
0
테케는 모두 통과인데, 틀리는 이유가 뭘까요?ㅠㅠ
from collections import deque table = deque() for i in range(4): table.append(deque(input())) # N == 0, S == 1 K = int(input()) K_table=[] for i in range(K): K_table.append(list(map(int,input().split()))) def clock(arr): a = arr.pop() arr.appendleft(a) return arr def unclock(arr): a = arr.popleft() arr.append(a) return arr def right(start, direction): if start>=3 or start <0: return if table[start][2]!=table[start+1][6]: if direction==1: unclock(table[start+1]) else: clock(table[start + 1]) right(start+1, direction*(-1)) def left(start, direction): if start<=0 or start>=4: return if table[start-1][2]!=table[start][6]: if direction==1: unclock(table[start-1]) else: clock(table[start-1]) left(start-1,direction*(-1)) for num,direction in K_table: right(num-1,direction) left(num-1, direction) if direction == 1: clock(table[num-1]) else: unclock(table[num-1]) ans=0 def score_print(table): global ans if table[0][0]=="1": ans += 1 if table[1][0]=="1": ans += 2 if table[2][0]=="1": ans+=4 if table[3][0] == "1": ans+=8 score_print(table) print(ans)
댓글을 작성하려면
로그인
해야 합니다.
smpa6379 2년 전
테케는 모두 통과인데, 틀리는 이유가 뭘까요?ㅠㅠ