====== Cow Jog ====== ===== 풀이 ===== * 같은 레인에서는 추월이 생기지 않는다는 것은 처음 순위가 그대로 유지된다는 것이고.. 처음 시점에서의 대소관계와 마지막 시점에서의 대소관계가 동일하다는 뜻이다. i번 소의 처음 포지션과 마지막 포지션을 x_i, y_i라고 두면, 같은 레인 안에 있는 소에 대해서는 x_1 """Solution code for "BOJ 10651. Cow Jog". - Problem link: https://www.acmicpc.net/problem/10651 - Solution link: http://www.teferi.net/ps/problems/boj/10651 Tags: [LIS] """ import bisect import sys MOD = 10_007 def main(): N, T = [int(x) for x in sys.stdin.readline().split()] final_pos = [] for _ in range(N): pos, speed = [int(x) for x in sys.stdin.readline().split()] final_pos.append(pos + speed * T) # Longest non-increasing sequence. arr = [] for x in final_pos: lis_len = bisect.bisect_right(arr, -x) if lis_len == len(arr): arr.append(-x) else: arr[lis_len] = -x print(len(arr)) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:플래티넘_5}}