摘要:
Abstract 传送门 Idea 显然是一个差分约束系统。不妨用 dist[i] 表示前 i 个位置种的树的数目,那么,容易得出下列方程: dist[i] >= dist[i-1] dist[i] - dist[i-1] <= 1 (每个位置至多能种一颗树) 题目要求 b 到 e 之间至少种 t 阅读全文
摘要:
Abstract 记录一些自己写的算法模板,防止重复造轮子。 图论 邻接表 Code namespace graph { int n; const int maxn = 10000000; int head[maxn]; int cnt; struct Edge { int next, to, va 阅读全文
摘要:
Abstract 第一次打 CF 的比赛~~~~ A. Legs Idea 签到题,没什么好说的。 Code #include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d", &t); while (t--) 阅读全文