如果不需要确定当前遍历到了哪一层,BFS模板如下。 while queue 不空: cur = queue.pop() for 节点 in cur的所有相邻节点: if 该节点有效且未访问过: queue.push(该节点) 如果要确定当前遍历到了哪一层,BFS模板如下。 这里增加了level表示当 ...
分类:
其他好文 时间:
2020-07-28 22:38:05
阅读次数:
77
luogu SuperJvRuo的图 各层内部正常连边,各层之间从上到下连权值为0的边。每向下跑一层,就相当于免费搭一次飞机。跑一遍从$s$到$t+n?k$的最短路即可。 #include<cstdio> #include<queue> #include<iostream> #include<cst ...
分类:
其他好文 时间:
2020-07-28 17:08:32
阅读次数:
59
从上到下打印二叉树,引用辅助队列。 C++版本 #include <iostream> #include <vector> #include <stack> #include <cstring> #include <queue> #include <algorithm> using namespac ...
分类:
其他好文 时间:
2020-07-28 10:00:15
阅读次数:
73
基于分布式异步框架celery 前文已知,celery可以执行异步任务、延时任务、定时任务。 broker:'redis://127.0.0.1:6379/2' # 消息队列(中间件) broker 可以使用Redis、RabbitMQ backend:'redis://127.0.0.1:6379 ...
分类:
其他好文 时间:
2020-07-27 23:58:21
阅读次数:
99
一 Redis基础 1.1 Redis安装 #1 key-value的存储方式, value有很多数据类型:5大:string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型 #2 非关系型内存数据库 #3 与Memcached比较: ...
分类:
其他好文 时间:
2020-07-27 23:52:58
阅读次数:
78
一、创建celery包 1、新建一个包,任意命名,如,celery_task。 2、包内创建celery对象,指定命名为celery.py: from celery import Celery broker = 'redis://127.0.0.1:6379/1' backend = 'redis: ...
分类:
其他好文 时间:
2020-07-27 23:34:07
阅读次数:
76
Celery 官方 Celery 官网:http://www.celeryproject.org/ Celery 官方文档英文版:http://docs.celeryproject.org/en/latest/index.html Celery 官方文档中文版:http://docs.jinkan. ...
分类:
其他好文 时间:
2020-07-27 17:55:00
阅读次数:
98
##题面 Problem Description There are n cities and m bidirectional roads in Byteland. These cities are labeled by 1,2,…,n, the brightness of the i-th cit ...
分类:
其他好文 时间:
2020-07-27 09:21:33
阅读次数:
88
celery的使用 # 1 异步任务框架,执行异步任务,执行延迟任务,执行定时任务 # 2 Celery is a project with minimal funding, so we don’t support Microsoft Windows. Please don’t open any i ...
分类:
其他好文 时间:
2020-07-26 23:15:34
阅读次数:
64
###思路 这个题不难,就是先Trajan缩点减小点数和边数的规模,然后在缩完点的图上跑DP即可。注意要用toposort解决DP后效性(或者是使用记忆化搜索)。 Code #include<iostream> #include<cstdio> #include<algorithm> #includ ...
分类:
其他好文 时间:
2020-07-26 23:07:29
阅读次数:
56