얼렁뚱땅 백준 문제풀이

[백준 문제풀이] 얼렁뚱땅 2641번 다각형그리기 풀이

MOSTAR 2022. 8. 22. 19:44

https://www.acmicpc.net/problem/2641

 

n = int(input())
answer = list(map(int,input().split()))
num = int(input())

temp_ = []
for i in range(n) :
	if answer[i] == 1 :
		temp_.append(3)
	elif answer[i] == 2 :
		temp_.append(4)
	elif answer[i] == 3 :
		temp_.append(1)
	else :
		temp_.append(2)

temp_.reverse()

best = []
for i in range(n) :
	best.append(answer[i:] + answer[:i])
	best.append(temp_[i:] + temp_[:i])

real_ = []

for i in range(num) :
	list_ = list(map(int,input().split()))
	if list_ in best :
		real_.append(list_)

print(len(real_))
for i in range(len(real_)) :
	print(*real_[i])