博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 2482 挑战 284
阅读量:4114 次
发布时间:2019-05-25

本文共 1175 字,大约阅读时间需要 3 分钟。

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std; #define MM(a) memset(a,0,sizeof(a)) typedef long long ll; typedef unsigned long long ULL; const int mod = 1000000007; const double eps = 1e-10; const int inf = 0x3f3f3f3f; const int big=50000; int max(int a,int b) {return a>b?a:b;}; int min(int a,int b) {return a
>1); build(2*k+2,(l+r)>>1,r); } void update(int k) { while(k>0) { k=(k-1)/2; data[k]=max(data[2*k+1],data[2*k+2]); } } void add(int k,int a,int b,int l,int r,int v) { //cout<<"3"<
=b) { //printf("1\n"); return; } else if(l<=a&&b<=r) { data[k]+=v; update(k); //printf("2\n"); return; } else if(r>a&&l
>1,l,r,v); add(2*k+2,(a+b)>>1,b,l,r,v); } } int main() { int n,a,b,rr; ne[0].y=0; while(~scanf("%d %d %d",&n,&a,&b)) { rr=0; for(int i=1;i<=n;i++) { scanf("%d %d %d",&ne[i].x,&ne[i].y,&ne[i].v); rr=max(rr,ne[i].x); } sort(ne+1,ne+n+1,cmp); build(0,0,rr+1); int ans=0,l=0,r=0; for(;;) { //cout<<"///1"<
n) break; //cout<<"2"<
n) break; add(0,1,rr+1,ne[l].x-a+1,ne[l].x+a,-ne[l].v); l++; } printf("%d\n",ans); } return 0; }

转载地址:http://btgsi.baihongyu.com/

你可能感兴趣的文章
启动 LocalDB 和连接到 LocalDB
查看>>
Palindrome Number --回文整数
查看>>
Reverse Integer--反转整数
查看>>
Container With Most Water --装最多水的容器(重)
查看>>
Longest Common Prefix -最长公共前缀
查看>>
Letter Combinations of a Phone Number
查看>>
Single Number II --出现一次的数(重)
查看>>
Valid Parentheses --括号匹配
查看>>
Remove Element--原地移除重复元素
查看>>
Remove Duplicates from Sorted Array--从有序数组中移除重复元素
查看>>
Count and Say
查看>>
Gas Station
查看>>
Palindrome Partitioning --回文切割 深搜(重重)
查看>>
Valid Palindrome 简单的回文判断
查看>>
Pascal's Triangle -- 生成杨辉三角
查看>>
Pascal's Triangle II 生成杨辉三角中的某行
查看>>
Minimum Depth of Binary Tree -- 二叉树的最小深度 DFS 加剪枝
查看>>
Climbing Stairs 爬楼梯方法 动态规划
查看>>
Merge Two Sorted Lists 合并两个有序链表
查看>>
pow(x,n) 为什么错这么多次
查看>>