/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.109 MiB
#2 Accepted 16ms 3.0 MiB

Code

T = int(input())
for _ in range(T):
    N = int(input())
    P = list(range(1, N + 1))
    
    for i in range(N - 1):
        if P[i] == i + 1:
            P[i], P[i+1] = P[i+1], P[i]

    # بررسی عنصر آخر:
    if P[N - 1] == N:
        P[N - 1], P[N - 2] = P[N - 2], P[N - 1]

    print(' '.join(map(str, P)))

Information

Submit By
Type
Submission
Problem
P1210 A. Smallest Permutation
Contest
Educational Round 1
Language
Python 3 (Python 3.12.3)
Submit At
2025-07-14 15:39:33
Judged At
2025-07-14 15:39:33
Judged By
Score
100
Total Time
16ms
Peak Memory
3.109 MiB