Submission #3234967


Source Code Expand

from bisect import bisect,insort
n,k = (int(i) for i in input().split())
a = [int(input())-k for i in range(n)]
b = [[0,0]]
for i in range(n): b.append([-(a[i]-b[-1][0]),-(i+1)])
b.sort()
q,ans,num = [-b[0][1]],0,1
for i,j in b[1:]:
	c = bisect(q,-j)
	ans+=num-c
	num+=1
	insort(q,-j,c,c)
print(ans)

Submission Info

Submission Time
Task E - Meaningful Mean
User Clamperl
Language Python (3.4.3)
Score 0
Code Size 311 Byte
Status TLE
Exec Time 2107 ms
Memory 53692 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 3
AC × 10
TLE × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23
Case Name Status Exec Time Memory
a01 AC 19 ms 3188 KB
a02 AC 17 ms 3064 KB
a03 AC 17 ms 3064 KB
b04 AC 17 ms 3064 KB
b05 TLE 2106 ms 35876 KB
b06 AC 649 ms 47276 KB
b07 TLE 2107 ms 50184 KB
b08 TLE 2106 ms 50160 KB
b09 TLE 2107 ms 51272 KB
b10 TLE 2107 ms 49176 KB
b11 AC 17 ms 3064 KB
b12 AC 20 ms 3188 KB
b13 AC 542 ms 21272 KB
b14 TLE 2107 ms 51052 KB
b15 AC 689 ms 47304 KB
b16 TLE 2106 ms 48288 KB
b17 TLE 2107 ms 49196 KB
b18 TLE 2106 ms 52124 KB
b19 AC 684 ms 53692 KB
b20 TLE 2107 ms 51156 KB
b21 TLE 2106 ms 42808 KB
b22 TLE 2107 ms 50200 KB
b23 TLE 2107 ms 50208 KB