CSES - Datatähti 2021 loppu - Results
 Task: Järjestäminen Sender: CursedTomb Submission time: 2021-01-23 17:36:11 +0200 Language: PyPy3 Status: READY Result: 0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.08 s1, 2details
#20.08 s2details
#30.08 s1, 2details
#40.07 s1, 2details

### Code

```t=int(input())

for i in range(t):
n = int(input())
arr = list(input())
arr = [int(i) for i in arr if i != " "]

arr2 = list(arr)
arr2.sort()
a = 1
while(arr is not arr2):
t = arr.index(a)
if(t==a):
a+=1
continue
if(t+1>n):
print("NO")
break
if(a==n):
print("NO")
break
tmp1 = arr[a-1]
tmp2 = arr[a]
arr[a-1], arr[a]= arr[t], arr[t+1]
arr[t], arr[t+1] = tmp1, tmp2
a+=1
if(a==n):
if(arr2==arr):
print("YES")
else:
print("NO")
break
```

### Test details

#### Test 1

Group: 1, 2

Verdict:

input
153
1
1
2
1 2
...

correct output
YES
YES
NO
NO
NO
...

user output
NO
YES
NO
NO
NO

Error:
```Traceback (most recent call last):
File "input/code.py", line 24, in <module>
arr[a-...```

#### Test 2

Group: 2

Verdict:

input
1000
59
35 29 32 50 11 15 9 21 19 45 2...

correct output
YES
NO
YES
NO
YES
...

user output
(empty)

Error:
```Traceback (most recent call last):
File "input/code.py", line 12, in <module>
t = ar...```

#### Test 3

Group: 1, 2

Verdict:

input
720
6
1 6 4 5 2 3
6
6 3 2 1 5 4
...

correct output
YES
NO
NO
NO
YES
...

user output
(empty)

Error:
```Traceback (most recent call last):
File "input/code.py", line 24, in <module>
arr[a-...```

#### Test 4

Group: 1, 2

Verdict:

input
1000
8
7 4 2 8 6 3 5 1
8
3 8 2 7 5 4 6 1
...

correct output
NO
NO
YES
NO
YES
...

user output
(empty)

Error:
```Traceback (most recent call last):
File "input/code.py", line 24, in <module>
arr[a-...```