链接:https://leetcode-cn.com/problems/subsets-ii/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> subsetsWith ...
分类:
其他好文 时间:
2020-07-16 00:27:10
阅读次数:
75
重新做了一下这道并查集的题目,关键要点是抓住这种循环的关系和模运算的通性,进而利用加权并查集 #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; cons ...
分类:
其他好文 时间:
2020-07-15 23:39:09
阅读次数:
63
Description A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. ...
分类:
其他好文 时间:
2020-07-15 23:20:22
阅读次数:
96
先讲下部分分怎么搞。 有个非常暴力的暴力做法: 对于每一个询问,把边权大于 \(w_j\) 的边加入,并查集维护联通块即可。 时间复杂度 \(\mathcal{O(qm)}\),可以过 \(\mathrm{Subtask\ 1}\) 当 \(t_i=2\) 的时候,可以直接 kruskal 重构树, ...
并查集的作用 并查集是用树的形式维护所有集合 每一个集合用一个树来维护 每一个集合的编号是它根节点的编号 令每一个树根的p[x] = x 然后对于每一个点,都存储一下这个点的父节点是谁,p[x] = ? 然后当我们想求某个点属于哪个集合的时候 就找到这个点的father,然后看其是不是树根,不是的话 ...
分类:
其他好文 时间:
2020-07-14 13:23:44
阅读次数:
48
题目描述 题解 必须要发掘出性质才能搞,乱找找不满 一草稿纸的114514越看越草 发现5只出现一次,而且14是114的子串 显然可以想到每次按最近的来匹配,一次找出一个114514 发现114511451414会挂掉,原因是把第二个5的114给拆掉了 1的数量最多,所以只考虑总量不考虑单独每个 对 ...
分类:
其他好文 时间:
2020-07-13 11:15:32
阅读次数:
64
##题面 Problem Description Queues and Priority Queues are data structures which are known to most computer scientists. The Queue occurs often in our dai ...
分类:
其他好文 时间:
2020-07-12 17:05:48
阅读次数:
132
列一下hdu,poj,CF上常见的Stirling数相关的习题(补充完善中): hdu2643 hdu3625 hdu4372 hdu4045 POJ1430 POJ2621 CF932E CF961G CF960G ...
分类:
其他好文 时间:
2020-07-12 16:52:18
阅读次数:
64
##题面 Problem Description Lele now is thinking about a simple function f(x). If x < 10 f(x) = x. If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x ...
分类:
其他好文 时间:
2020-07-12 16:40:31
阅读次数:
59
#include<iostream> #include<cmath> #include<algorithm> #include<string> #include<cstring> #define DEBUG if( 1 )//是否输出调试用信息 using namespace std; int W, ...
分类:
其他好文 时间:
2020-07-11 19:21:29
阅读次数:
61