menu
ZJOJ
account_circle
请登录
登录
注册
home
首页
book
题目
apps
分类
play_circle_outline
状态
assessment
竞赛
assignment
作业
equalizer
排名
assignment_ind
登录
person_add
注册
1547: 爆破计划
时间限制:
2.000s
内存限制:
128MB
提交
通过: 2
提交: 3
统计
题目描述
有一个n行m列的棋盘,棋盘上放置有k个棋子(不会有两个棋子放置在同一位置上),每个棋子有一定分数,击败可以获得对应分数。
小紫有一枚炸弹,可以放置在棋盘上的任意一个位置(不管这个位置是否有棋子),并造成十字型的伤害,击败能够攻击到的所有棋子。即,若炸弹放置在r行c列的位置,则第r行的所有棋子和第c列的所有棋子都会被击败(若炸弹放置位置有棋子,该棋子同样被击败),小紫能够获得相应分数。
小紫希望自己获得的分数最高,你能告诉他,他所能获得的最高分数是多少吗?
输入格式
第一行:三个整数
lns="http://www.w3.org/1998/Math/MathML">
n,m,k
n
,
m
,
k
,表示棋盘的行数、列数和放置棋子的个数。(
lns="http://www.w3.org/1998/Math/MathML">
1 \le n,m \le 10^5
1
≤
n
,
m
≤
1
0
5
,
lns="http://www.w3.org/1998/Math/MathML">
1 \le k \le min(n\times m,10^5)
1
≤
k
≤
m
i
n
(
n
×
m
,
1
0
5
)
)。
接下来
lns="http://www.w3.org/1998/Math/MathML">
k
k
行:每行三个整数
lns="http://www.w3.org/1998/Math/MathML">
x_i,y_i,w_i
x
i
,
y
i
,
w
i
,表示第
lns="http://www.w3.org/1998/Math/MathML">
i
i
个棋子的行位置、列位置、分数。(
lns="http://www.w3.org/1998/Math/MathML">
1 \le x_i \le n
1
≤
x
i
≤
n
,
lns="http://www.w3.org/1998/Math/MathML">
1 \le y_i \le m
1
≤
y
i
≤
m
,
lns="http://www.w3.org/1998/Math/MathML">
1 \le w_i \le 10^4
1
≤
w
i
≤
1
0
4
)
输出格式
一个整数,表示所能获得的最高分数
样例输入
content_copy
3 3 4 1 1 5 2 3 8 3 1 3 3 3 2
样例输出
content_copy
16
分类
set vector
提交