
线段树
swqeaaa
有问题可以吻我
展开
-
牛客 2019 多校 1 C E I dp 线段树 思维
C Euclidean Distance题意: 给出高维空间的一个点A, 求另一个点P满足坐标非负且坐标和为1, 使得P到A的距离最小.真正的思路:https://www.cnblogs.com/dillonh/p/11215846.html虚假的思路: 本以为可以用拉格朗日乘子法做, 最后发现没有考虑坐标非负的条件, 不是只有等值约束,还有n个不等式约束, 所以L函数会多n个系数不...原创 2019-07-24 00:00:30 · 136 阅读 · 0 评论 -
【线段树】【扫描线】【面积并】HDU - 1542 Atlantis
【题目】http://acm.hdu.edu.cn/showproblem.php?pid=1542【大意】【思路】【代码】#include <bits/stdc++.h>using namespace std;const int N=505;int add[N<<2];double x[N<<2],sum[N<<2];...原创 2018-08-01 21:38:07 · 140 阅读 · 0 评论 -
【线段树】HDU - 4614 Vases and Flowers
【题目】http://acm.hdu.edu.cn/showproblem.php?pid=4614【大意】【思路】【代码】#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int maxn=50000+10;struct ...原创 2018-08-01 21:38:18 · 149 阅读 · 0 评论 -
【线段树】HDU - 3974 Assign the task
【题目】http://acm.hdu.edu.cn/showproblem.php?pid=3974【题意】【思路】【代码】#include<bits/stdc++.h>const int M=50005;int fa[M];int task[M];int tsknum[M];int tot=0;int main(){ int tt,c...原创 2018-08-01 21:38:13 · 94 阅读 · 0 评论 -
【线段树】HDU - 1540 Tunnel Warfare
【题目】http://acm.hdu.edu.cn/showproblem.php?pid=1540【题意】【思路】【代码】#include<bits/stdc++.h>using namespace std;const int M=50005;int n,m;int s[M],top;//s为模拟栈class node{public: in...原创 2018-08-01 21:38:24 · 108 阅读 · 0 评论 -
【线段树】POJ - 2528 Mayor's posters
【题目】http://poj.org/problem?id=2528【题意】【思路】【代码】#include<algorithm>#include<cstdio>using namespace std;const int M=100005;int flag;class Post{public: int x,id;};Post pos...原创 2018-08-03 08:40:23 · 95 阅读 · 0 评论 -
【线段树】HDU - 4027 Can you answer these queries?
【题目】http://acm.hdu.edu.cn/showproblem.php?pid=4027【题意】【思路】【代码】#include<bits/stdc++.h>using namespace std;long long n;long long arr[100005];long long Tree[800005];void create(long...原创 2018-08-03 08:40:31 · 102 阅读 · 0 评论 -
CF 1208D Restore Permutation 线段树
现在藏起来一个1到n(2e5)的排列, 对于每个位置i, 给出a[1]到a[i-1]中小于a[i]的数的和s[i], 让我们求这个排列a.首先我们找找1的位置.因为没有数比1小, 所以不论1在哪里, 它的s肯定是0;而如果s中有多个0, 1一定在最后一个0—因为如果1在其他0的位置, 最后一个0没法解释—不论最后一个数是什么, 它肯定比1大, 前面的1一定会对这个数产生贡献, 这样我们就证明...原创 2019-09-04 09:33:20 · 238 阅读 · 0 评论