CF1517G.Starry Night Camping
NOI/NOI+/CTSC
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
At the foot of Liyushan Mountain, n tents will be carefully arranged to provide accommodation for those who are willing to experience the joy of approaching nature, the tranquility of the night, and the bright starry sky.
The i-th tent is located at the point of (xi,yi) and has a weight of wi. A tent is important if and only if both xi and yi are even. You need to remove some tents such that for each remaining important tent (x,y), there do not exist 3 other tents (x1′,y1′), (x2′,y2′) and (x3′,y3′) such that both conditions are true:
- ∣xj′−x∣,∣yj′−y∣≤1 for all j∈1,2,3, and
- these four tents form a parallelogram (or a rectangle) and one of its sides is parallel to the x-axis.
Please maximize the sum of the weights of the tents that are not removed. Print the maximum value.
在李雨山山脚下,将精心布置 n 顶帐篷,为那些渴望亲近自然、感受夜晚宁静与璀璨星空的人们提供住宿。
第 i 顶帐篷位于坐标 (xi,yi) 处,权重为 wi。当且仅当 xi 和 yi 均为偶数时,该帐篷被称为“重要帐篷”。你需要移除若干顶帐篷,使得对每一个剩余的重要帐篷 (x,y),都不存在另外三顶帐篷 (x1′,y1′)、(x2′,y2′) 和 (x3′,y3′) 同时满足以下两个条件:
- 对所有 j∈{1,2,3},均有 ∣xj′−x∣≤1 且 ∣yj′−y∣≤1;
- 这四顶帐篷构成一个平行四边形(或矩形),且其一条边与 x-轴平行。
请最大化未被移除帐篷的权重之和,并输出该最大值。
输入格式
The first line contains a single integer n (1≤n≤1000), representing the number of tents.
Each of the next n lines contains three integers xi, yi and wi (−109≤xi,yi≤109, 1≤wi≤109), representing the coordinate of the i-th tent and its weight. No two tents are located at the same point.
第一行包含一个整数 n(1≤n≤1000),表示帐篷的数量。
接下来的 n 行中,每行包含三个整数 xi、yi 和 wi(−109≤xi,yi≤109,1≤wi≤109),分别表示第 i 个帐篷的坐标及其重量。任意两个帐篷均不位于同一点。
输出格式
A single integer — the maximum sum of the weights of the remaining tents.
一个整数——剩余帐篷的重量之和的最大值。
输入输出样例
输入#1
5 0 0 4 0 1 5 1 0 3 1 1 1 -1 1 2
输出#1
12
输入#2
32 2 2 1 2 3 1 3 2 1 3 3 1 2 6 1 2 5 1 3 6 1 3 5 1 2 8 1 2 9 1 1 8 1 1 9 1 2 12 1 2 11 1 1 12 1 1 11 1 6 2 1 7 2 1 6 3 1 5 3 1 6 6 1 7 6 1 5 5 1 6 5 1 6 8 1 5 8 1 6 9 1 7 9 1 6 12 1 5 12 1 6 11 1 7 11 1
输出#2
24
说明/提示
Here is an illustration of the second example. Black triangles indicate the important tents. This example also indicates all 8 forbidden patterns.

以下是第二个示例的图示。黑色三角形表示重要的帐篷。该示例还标出了全部 8 种禁止出现的模式。

输入解题思路,AI测评打分。不知道怎么写?