- 博客(6)
- 收藏
- 关注
原创 最小邮票数【清华大学】
01背包#include <cstdio>#include <iostream>#include <cstring>#include <vector>using namespace std;const int N = 32;const int M = 128;const int MAX = 0x3f3f3f3f;int w[N]; int main(){ int m, n; scanf("%d %
2021-05-28 15:13:07 74
原创 2518 和为S
题目链接前缀和哈希表#include <iostream>#include <vector>#include <cstring>#include <unordered_map>using namespace std;const int N = 3e5+5;int nums[N];int sum[N];int main(){ int n; cin>>n; memset(nums, 0, sizeof nums); u
2021-05-23 11:09:41 113
原创 与数组中元素的最大异或值
LeetCode1707. 与数组中元素的最大异或值trie树异或和排序class Solution {public: struct Node{ int x, m, k; bool operator<(const Node& a)const{ return m < a.m; } }q[100005]; int son[3200005][2]; int idx = 0;
2021-05-23 10:07:11 178
原创 单源最短路模板题
C++版牛客网题目链接注意处理重边class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int 顶点数 * @param m int 边数 * @param graph intvector<vector<>> 一维3个数据,表示顶点到另外一个顶点的边长度是多少 * @return in
2021-05-12 14:36:51 127
原创 单调栈模板题
CPP版牛客网题目链接主要参照AcWing基础课讲的单调栈,注意这里统计的是下标位置而不是值。class Solution {public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums intvector * @return intvector<vector<>> */ // NC157 单调栈 vector&
2021-05-12 14:10:05 136
原创 jyy《操作系统》P12
大纲线程 & 协程同步 & 通信分布式系统协程协程: 有限的并行和并发执行流切换只发生在主动放弃CPU的时刻yield的时机是完全确定的协程不能同时使用多个CPUpython中的generator就是协程IO耗时协程: 一个人干,他人围观。线程:每个线程占用可观的OS资源Goroutine多处理器并行&轻量级并发我全都要实现方式:每个CPU上有一个go worker,自由调度goroutines,执行blocking API时(如sleep
2021-05-05 14:50:00 588
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人