기출 문제 / ACPC 2025 ACPC

Cody's Sorting

While learning how to sort sequences, Cody decided to create and apply his own unique sorting method.

Given a sequence of N integers A=[A1,A2,…,AN], Cody's sorting rule is as follows:

First, initialize the variable s to 1; s denotes the current position within the sequence A.