시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB0000.000%

문제

A kill switch is a mechanism used to shut off a device in an emergency situation.

Jeremy was hired as a contractor by a shady software company. After he finished his work the company pointed to a loophole in the contract and refused to pay him anything for his work. Little do they know that Jeremy suspected foul play and thus he hid a kill switch in his code.

You are given the implementation of a function that pretends to sort an array of 32-bit unsigned integers into a non-decreasing order. Find the shortest input the function fails to sort.

입력

In each subproblem there are two input files: one is a C++ implementation and the other a Python implementation of the same function.

(You may assume that if the answer is n, the two programs behave the same way at least on all valid inputs of size up to n + 47. Note that huge inputs may cause integer overflows in the C++ implementation. Such inputs are not a part of this problem and they can be safely ignored.)

출력

Your output file should contain two lines. The first line should contain a nonnegative integer n: the smallest possible length of an array that is not sorted correctly. The second line should contain one possible initial content of the array: the sequence A[0],…,A[n − 1]. These values must satisfy 0 ≤ A[i]<232.

예제 입력 1

void example_sort(vector<unsigned> &A) {
    int N = A.size();
    if (N >= 2 && A[0] > A[1])
        swap( A[0], A[1] );
    if (N >= 3 && A[0] > A[2])
        swap( A[0], A[2] );
    if (N >= 3 && A[0] > A[1])
        swap( A[0], A[1] );
}
-----------------------------------------
def example_sort(A):
    N = len(A)
    if N >= 2 and A[0] > A[1]:
        A[0], A[1] = A[1], A[0]
    if N >= 3 and A[0] > A[2]:
        A[0], A[2] = A[2], A[0]
    if N >= 3 and A[0] > A[1]:
        A[0], A[1] = A[1], A[0]

예제 출력 1

3
42 47 1

제출할 수 있는 언어

Text

채점 및 기타 정보

  • 예제는 채점하지 않는다.