| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 7 초 (추가 시간 없음) | 1024 MB | 36 | 19 | 15 | 71.429% |
In recent years, CPU manufacturers have found it increasingly difficult to keep up with Moore's law of doubling the number of transistors on integrated circuit chips every two years. To address this, manufacturers have instead started creating CPUs with an increasingly higher number of cores. In fact, you just purchased a CPU with a staggering $n$ number of cores, no less!
Incidentally, you also have an array of $n+1$ integers, $a_0, a_1, \ldots, a_n,ドル that you need to sort. To make good use of the large number of cores on your CPU, you have devised a parallel sorting algorithm in which there is a dedicated core for comparing each adjacent pair of integers. As long as the array is not sorted in non-decreasing order, the algorithm proceeds in rounds that alternate between:
Note that in both types of rounds some cores may be idle.
Before implementing this algorithm, you have decided to do some analysis. In particular, you noticed that the time complexity of the algorithm does not depend on the value of $n,ドル but rather it depends on the number of rounds that the algorithm runs. Given the initial contents of the array, determine the number of rounds that the parallel sorting algorithm runs before the array becomes sorted.
The input consists of:
Output the number of rounds that the parallel sorting algorithm runs before the array becomes sorted in non-decreasing order.
3 8 13 4 10
3
5 13 12 14 10 14 12
3
2 2 2 1
3
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2022 A번