#802. 射击游戏T5

射击游戏T5

No submission language available for this problem.

题目描述

游乐场新出了一个射击游戏。

现在有nn个射击目标,第ii个射击目标会在tit_i时刻后消失,即tit_i时刻前如果完成射击并命中目标,即可获得wiw_i价值的奖励。

作为神枪手的蜗牛老师,为了保证每次都命中目标,每个单位时刻只能瞄准一个目标并射击,才能保证每次都能命中目标。

现在问,蜗牛老师能够获得的最大奖励是多少?

输入格式

第一行一个整数nn,表示有nn个射击目标。

接下来nn行,每行22个整数:ti,wit_i,w_i

输出格式

一个整数,表示所求答案。

样例数据

input

4
1 19
2 10
1 20
2 15

output

35

数据规模与约定

20%的数据,n<=100。

40%的数据,n<=50000。

100%的数据,n<=200000,wi32767|w_i| \le 327670<ti<2310 < t_i <2^{31}

时间限制:1s1 \text {s}

空间限制:256MB256 \text {MB}

Background

Special for beginners, ^_^

Description

Given two integers x and y, print the sum.

Format

Input

Two integers x and y, satisfying 0x,y327670\leq x,y\leq 32767 .

Output

One integer, the sum of x and y.

Samples

123 500
623

Limitation

1s, 1024KiB for each test case.