摘要:
基本上是一个斜率优化裸题了 cpp include using namespace std; typedef long long ll; const int maxn = 1e6+10; ll s[maxn],x[maxn],n,a,b,c,f[maxn],ss[maxn]; int q[maxn] 阅读全文
摘要:
题解 我们枚举建厂的位置,发现有个$n^2$的DP。随手搞个斜率优化到$O(n)$。 cpp include using namespace std; typedef long long ll; const int maxn = 21000 ; const ll inf = 100000000000 阅读全文
摘要:
题解 我们考虑将棋盘扩大一倍,这样相当于取膜。然后,我们只要对x,y,的位置分类讨论,做四次crt就行。具体细节看文文代码。 cpp include include typedef long long ll; const ll inf = 1000000000000LL; int a[10],m[1 阅读全文
摘要:
无需逆元版本: cpp include include include include typedef long long ll; ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; } ll qpow(ll a,ll b,ll p) { ll ret = 1; w 阅读全文