匈牙利算法 #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <queue> using namespace std; #define ll long long #define pb ...
分类:
编程语言 时间:
2020-05-29 23:35:50
阅读次数:
77
双指针反转 class Solution { public: void reverseString(vector<char>& s) { int start = 0; int end = s.size() - 1; while (start < end) { swap(s[start], s[end ...
分类:
其他好文 时间:
2020-05-29 23:31:50
阅读次数:
107
比赛链接 ###A Berland Poker 简单题 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<vector> #include<queu ...
分类:
其他好文 时间:
2020-05-29 22:54:11
阅读次数:
63
支配树 (一下的节点大小比较默认为dfs序的大小) idom支配点——s->t的必经点 sdom半支配点 半支配点 $sdom[w]$为能到达w点的v的最小值,要求路径上处理起点终点外所有点大于w 性质: 半支配点唯一 半支配点一定是dfs树上的祖先 任意点w(w不等于起点s)的支配点是该节点半支配 ...
分类:
其他好文 时间:
2020-05-29 20:58:16
阅读次数:
55
题目描述 从上到下按层打印二叉树,同一层结点从左至右输出。每一层输出一行。 思路:层次遍历 vector<vector<int> > Print(TreeNode* pRoot) { vector<vector<int> > vec; if(pRoot == NULL) return vec; qu ...
分类:
其他好文 时间:
2020-05-29 17:48:51
阅读次数:
45
ROADS 思路:K = 10000,djkstra复杂度O(nlogn),如果我们把不同点的不同花费拆点,即d[花费][点] = 距离,则被拆为 N*K个点,则djkstra复杂度O(k*n*logn),复杂度可以接受。 #include <iostream> #include <vector> ...
分类:
其他好文 时间:
2020-05-29 17:38:59
阅读次数:
40
拯救大兵瑞恩 思路:钥匙种类p = 10,我们可以拥有不同种类钥匙,通过这个我们可以把图分成2^p层,表示拥有不同种类钥匙的情况。 #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include ...
分类:
其他好文 时间:
2020-05-29 13:34:32
阅读次数:
49
1. LeetCode Link LeetCode 1051. 高度检查器 2. Tag 数组 Optimize 3. Code 桶排序,时间复杂度$O(n)$ class Solution { public: int heightChecker(vector<int>& heights) { in ...
分类:
其他好文 时间:
2020-05-29 09:53:51
阅读次数:
66
多项式杂谈(更新中) 前言 最近在学习多项式,稍微开个坑吧。 一些比较好的学习资料、模板: 多项式大杂烩 - Froggy 珂学家的博客 【多项式n连】各种多项式模板(从入门到入土) 我个人习惯写指针,在我的模板中基本没有 vector,可能是我觉得 vector 常数大吧。 本文以存板子为主,一些 ...
分类:
其他好文 时间:
2020-05-28 21:19:50
阅读次数:
91
Java工具包提供了强大的数据结构。在Java中的数据结构主要包括以下几种接口和类: 枚举(Enumeration) 位集合(BitSet) 向量(Vector) 栈(Stack) 字典(Dictionary) 哈希表(Hashtable) 属性(Properties) 以上这些类是传统遗留的,在J ...
分类:
编程语言 时间:
2020-05-28 16:42:13
阅读次数:
65