没有实力
追踪最近的用户名外显变动记录。
最近的文章、讨论、云剪贴板与社区记录
本蒻犇看了第一篇置顶题解,但是有一个不理解的地方: ``` 这样就好办了,C_i 是已知(额,至少是可以预处理出来)的,要想最小化上式, 我们把 C_i 看成数轴上的一个个点,现在问题就转化成了找出一个点,使得它到各个上的点的距离和最小。这个点就是这 n 个点的中位数。 ``` 为什么这个点一定是要为 C_i 中的一个…
```cpp #include #include #include #include using namespace std; const int N = 1e3+1; inline int read() { int x = 0, f = 1; char ch = getchar(); while(ch < '0' |…
刚才在 CF 上写题,用到 gcd, 手搓了一个,结果跑出来 gcd(1, 1) = 0, 吓得我赶紧去 oi-wiki 看了一下 gcd 模板,然鹅模板和我的代码除变量名外一模一样,可是那个 gcd(1, 1) 跑出来是 1,求问为什么。 oi-wiki: ```cpp int gcd(int a, int b) {…
```cpp #include #include using namespace std; const int N = 1e5+10; int root = 0, idx = 0, val[N], cnt[N], son[N][2], siz[N], fa[N]; int get(int x) { return son…
在讨论《求散列法相关题目》回复:
@[rgw2010__](/user/1016560) 相信你应该知道这所谓“散列法”其实就是双哈希的吧?
在讨论《不理解双hash错哪里了》回复:
查了半天终于懂了: 在get_hash是如果传入的k(也就是get_sum(str))过大的话,k会超出long long的范围,变成负数,要判断一下。 就像这样: ```cpp #include #include #include using namespace std; typedef long long LL;…
rt,除#3,#4,#5以外全部re,27pts ```cpp #include #include #include using namespace std; typedef long long LL; const int M = 23333; int n, cnt = 0; string linker[M + 3];…
输入包含 $n$ 个整数的数列 $S$ 以及包含 $q$ 个不重复整数的数列 $T$,输出既包含于 $S$ 也包含于 $T$ 的整数的个数 $C$。 输入样例: ``` 5 1 2 3 4 5 3 3 4 1 ``` 输出样例: ``` 3 ``` 用此代码跑出来的结果是 $2$,真的特别无语。。。 ```cpp /*…
一开始我想的是,只要 a = b,就可以全部变为 c ,反之则不行,但是此思路不行。 比如这个数据:2,3,4 如果用假思路来运行的话,就会把 b 判为不可以消成 0的,可实际上可以用以下步骤消成 0: 0,5,2 1,4,1 0,5,0
在讨论《维护首项及公差做法,0pts,求助》回复:
突然发现$pushdown$函数里面维护子树的$k$值貌似写错了: ```cpp l.k += u.k, r.k += u.k; // r.k 的首项不只是加 u.k ``` 然后改了一下,交了一发,结果还是错的: ```cpp #include #include using namespace std; const…
在讨论《维护首项及公差做法,0pts,求助》回复:
注:$get$函数用于求解首项为$k$,公差为$d$,长度为$len$等差数列的总和。虽然写法有点臃肿,但是实测没问题。
代码: ```cpp #include #include using namespace std; const int N = 1e5+10; struct Node { int l, r; int sum, k, d; } tr[N > 1; build(2 * p, l, mid); build(2 * p + 1…
就离谱,样例能跑出负数来。。。 ```cpp #include #include using namespace std; const int N = 1e5+10; struct Node { int l, r; int sum, tag; } tr[N > 1; build(2 * p, l, mid); buil…
代码: (经过debug大概可以确定出错在了build函数中,但是不知道具体是哪里) ```cpp #include #include #include using namespace std; const int N = 8*1e4+10,M=2*1e5+10; struct Edge { int u, v, w;…
在讨论《Treap样例都不过》回复:
@[jqQt0220](/user/678175) 额,这个是我自己在调的时候搞的,因为我用的是 Sublime 而且不知道为什么不能直接像 Dev-cpp 那样弹出窗口调试,我又懒得搞,平时打代码就习惯于直接用 freopen 了。 而且提交得时候把那里注释掉了的,所以并不是那里有问题。
在讨论《求本题做法》回复:
总结为:思路大致没错,但方程冗余 [提交记录](https://www.luogu.com.cn/record/129575221), T 了一大堆点。 代码: ```cpp #include #include #include #include using namespace std; #define int lon…
在讨论《你的题解可能被毙了!(1)》回复:
qp
在讨论《抄蓝书的Treap93求调》回复:
@[PlauAix](/user/746944) 哦,懂了,谢
在讨论《抄蓝书的Treap93求调》回复:
@[PlauAix](/user/746944) 可是如果根本不存在的话,也不会是第一名啊
在讨论《抄蓝书的Treap93求调》回复:
@[PlauAix](/user/746944) 额,我也是同样的问题,不过为什么要这样?不理解,求大佬解答
rt ```cpp #include #include #include using namespace std; const int N = 1e6+10, INF = 1e8; struct Node { int ls, rs; int key, val; int siz, cnt; } tr[N]; int ro…
提交记录:[70 pts](https://www.luogu.com.cn/record/116146722) ```cpp #include #include #include #include #include using namespace std; #define maxn 200005 int n, tmp…
rt,本人蒻犇,每次写DP题的时候都debug不出来,这种情况到考场上是不是就寄了 比如:[ P2704 [NOI2001] 炮兵阵地](https://www.luogu.com.cn/problem/P2704) 一开始按照自己的思路写了份 20 pts 代码:[20 pts](https://www.luogu.…
在讨论《除#1 #2 外全部WA,20 pts状压求调》回复:
@[ZYK_luogu](/user/742157) 求解答
在讨论《除#1 #2 外全部WA,20 pts状压求调》回复:
不知道为什么,核心做法没变,换了一种写法怎么就过了? ```cpp #include #include using namespace std; const int N = 110, M = 1 state; vector head[M]; bool check(int st) { return !(st & st >…
在讨论《炮兵阵地深夜求调(悬赏2个关注)》回复:
@[Turtle_zhu](/user/443675) 那你可以看一下我的20pts代码嘛 [我的帖子](https://www.luogu.com.cn/discuss/700731)
在讨论《炮兵阵地深夜求调(悬赏2个关注)》回复:
有没有这样一种可能,你最后不应该把ans+=f[n&1][s1][s2],而是应该取max?