Sort 11 Discussions, By:
Please Login in order to post a comment
Here's how I did in all languages Java 8 , C++ , C , Python 3, Python 2.
Python 3 code
n = int(input())
inp = (map(int, input().split()) for i in range(n))
p = sorted(list((a + b, a - b) for a, b in inp))
a = list(y for x, y in p)
d = 
for x in a:
low, high = -1, len(d) # >, <=
while high - low > 1:
mid = (low + high) >> 1
if d[mid] > x:
low = mid
high = mid
if high == len(d):
d[high] = x
does an increase in the frequency by 1 for example means it's gonna take time of the same amount(1) to be adjusted? i mean if does an increase in frequency by 1 requires 1 unit of time ??
I have an algorithm what gives less than expected output, for example for case 4, it gives 15. And could not find a cause.
All missiles are hit and enough spare time to change frequency.
Have I missed something obvious?
Can somebody help me with how Dilworth's theorem is being used to draw the inference as it is being done in the editorial?