Submission #3188443


Source Code Expand

import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


dic = dict()

n = ni()
a = []
for _ in range(n):
    a.append(ni())
    
b = sorted(a)

for i, ai in enumerate(a):
    dic[ai] = (i, b.index(ai))
    
cnt = 0
for ord1, ord2 in dic.values():
    if ord1%2 != ord2%2:
        cnt += 1
        
print(cnt // 2)

Submission Info

Submission Time
Task C - BBuBBBlesort!
User polarbear08
Language Python (3.4.3)
Score 0
Code Size 686 Byte
Status TLE
Exec Time 2104 ms
Memory 12588 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 2
AC × 7
TLE × 17
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt TLE 2104 ms 8284 KB
02.txt TLE 2104 ms 8288 KB
03.txt TLE 2104 ms 8296 KB
04.txt TLE 2104 ms 8296 KB
05.txt TLE 2104 ms 8296 KB
06.txt TLE 2104 ms 8172 KB
07.txt TLE 2104 ms 8296 KB
08.txt TLE 2104 ms 10792 KB
09.txt TLE 2104 ms 10792 KB
10.txt TLE 2104 ms 8108 KB
11.txt TLE 2104 ms 8116 KB
12.txt TLE 2104 ms 10668 KB
13.txt TLE 2104 ms 12588 KB
14.txt TLE 2104 ms 8292 KB
15.txt TLE 2104 ms 8176 KB
16.txt TLE 2104 ms 8172 KB
17.txt TLE 2104 ms 8248 KB
18.txt AC 17 ms 3064 KB
19.txt AC 17 ms 3064 KB
20.txt AC 17 ms 3064 KB
21.txt AC 17 ms 3064 KB
22.txt AC 17 ms 3064 KB
s1.txt AC 17 ms 3064 KB
s2.txt AC 17 ms 3064 KB