什么是闵可夫斯基和? 在几何上,给定两个点集 $A$ 和 $B$,它们的闵可夫斯基和定义为: $$ C = A + B = { a + b \mid a \in A, b \in B } $$ 也就是把 $A$ 中的每一个点和 $B$ 中的每一个点做向量加...
NOI2020 游记
MY OI
IOI2020 集训队作业
树上背包时间复杂度证明
P2014 [CTSC1997] 选课 本文证明树上背包的时间复杂度是 $\mathcal O(nm)$ 的。换言之,上题可以加强至:$n \le 3 \times 10^5$,$m \le 300$。 首先给出代码实现: #include <bits/stdc++.h> using...
AtCoder Grand Contest 047 题解
AtCoder Grand Contest 047 Integer Product 考虑 $\times 10^9$ 之后质因子中 $2,5$ 的次数,卡精度。 const int M = 57, inf = 1e9; int n, c[M][M]; ll ans; int main() { ios::sync_with_stdio(0...
AtCoder Grand Contest 020 题解
AtCoder Grand Contest 020 Move and Win 答案只与 $a,b$ 是否同奇偶有关。 int main() { int n, a, b; rd(n, a, b); prints((a ^ b) & 1 ? "Borys" : "Alice"); return 0; } Ice R...
AtCoder Grand Contest 021 题解
AtCoder Grand Contest 021 Digit Sum 2 枚举答案与 $n$ 从高到低第一个不同的位。 int main() { string s; cin >> s; int ans = 0; for (char c : s) ans += c - '0'; for (ui...
AtCoder Grand Contest 022 题解
AtCoder Grand Contest 022 Diverse Word 分类讨论一下即可。 int main() { string s; cin >> s; if ((int)s.size() == 26) { string t = s; if (next_permutation(t.b...
AtCoder Grand Contest 023 题解
AtCoder Grand Contest 023 Zero-Sum Ranges 前缀和一下直接计数即可。 const int N = 2e5 + 7; int n, a[N]; ll s, ans; int main() { rd(n), rda(a, n); map<ll, int> c; for (int i...
