본문 바로가기

Python/USACO

USACO 2020 January Contest, BronzeProblem 2

http://www.usaco.org/index.php?page=viewproblem2&cpid=988 

 

USACO

Farmer John is lining up his $N$ cows ($2\le N\le 10^3$), numbered $1\ldots N$, for a photoshoot. FJ initially planned for the $i$-th cow from the left to be the cow numbered $a_i,$ and wrote down the permutation $a_1,a_2,\ldots,a_N$ on a sheet of paper. U

www.usaco.org

python3 을 이용하였고 테스트 셋을 통과했습니다. 특징적인 부분은 스타팅 지점을 따로 구하지 않고 perm 리스트처럼 표현했습니다. 그리고 반복문 안에서 브레이크 포인트를 2개를 잡아 모두 실행하지 않게 구성되어 있습니다.

반응형

'Python > USACO' 카테고리의 다른 글

USACO 2020 January Contest, Bronze problem1  (0) 2021.09.29