Submission #3188457


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 PyPy3 (2.4.0)
Score 0
Code Size 686 Byte
Status TLE
Exec Time 2106 ms
Memory 50992 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 2106 ms 48092 KB
02.txt TLE 2106 ms 48092 KB
03.txt TLE 2106 ms 48092 KB
04.txt TLE 2106 ms 48092 KB
05.txt TLE 2106 ms 48348 KB
06.txt TLE 2106 ms 48348 KB
07.txt TLE 2106 ms 48348 KB
08.txt TLE 2105 ms 50960 KB
09.txt TLE 2106 ms 48348 KB
10.txt TLE 2106 ms 48348 KB
11.txt TLE 2106 ms 48348 KB
12.txt TLE 2105 ms 50992 KB
13.txt TLE 2106 ms 48348 KB
14.txt TLE 2106 ms 48348 KB
15.txt TLE 2106 ms 48348 KB
16.txt TLE 2106 ms 48348 KB
17.txt TLE 2106 ms 48348 KB
18.txt AC 162 ms 38256 KB
19.txt AC 162 ms 38256 KB
20.txt AC 163 ms 38256 KB
21.txt AC 162 ms 38256 KB
22.txt AC 163 ms 38256 KB
s1.txt AC 162 ms 38256 KB
s2.txt AC 163 ms 38256 KB