본문 바로가기
Programming Test/문제풀이

[문제 풀이 15] 코드 트리 - 섞기 전 카드 위치

by muns91 2024. 4. 17.
섞기 전 카드 위치

 

  • 문제 유형 : Simulation
  • 사용언어 : Python
  • 난이도 : 실버 5
  • 출처 : 코드 트리

https://www.codetree.ai/training-field/search/problems/card-position-before-shuffling?&utm_source=clipboard&utm_medium=text

 

코드트리 | 코딩테스트 준비를 위한 알고리즘 정석

국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.

www.codetree.ai

 

n = int(input())

# Before shuffle
location = list(map(int, input().split()))
card = list(map(int, input().split()))


cnt = 0

list_set = []

before_location = [0]*len(location)
for _ in range(3):
    
    for idx, loc in enumerate(location):
        before_location[idx] = card[loc-1]
 
    card = before_location.copy()


for i in card:
	print(i)