编译时期计算数组

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #include <iostream> #include <array> using namespace std; constexpr int N = 1000000; constexpr int f(int x) { return x*2; } typedef array<int, N> A; template<int... i> constexpr A fs() { return A{{ f(i)... }}; } template<int...> struct S; template<int... i> struct S<0,i...> { static constexpr

UVALive 5848. Soju

1 题目大意给定两个平面上的点集,求两个点集中距离最近的两个点的距离。(这里的距离说的是曼哈顿距离。)题目中保证了左边点集的点都一定在右侧的点

主席树

主席树我的理解是可持久化线段树的一种应用吧。本质上就是可持久化线段树,不过我们在查询的时候用到了他们之间可以相减的性质。 首先介绍一下可持久化