上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 50 下一页
摘要: problem有n个小组,进行排队。当一个人来到队伍时,若队伍中有自己小组成员时,他就直接站到其后面如果没有,则站到队伍最后面,形成自己小组的第一个入队元素。出队列时,给出出队指令,输出出队成员号码。solution维护一个队列数组q和总队列p,分别表示每个小组在队伍... 阅读全文
posted @ 2018-06-01 20:59 gwj1139177410 阅读(149) 评论(0) 推荐(0)
摘要: problem给你一个n个点m条边的无向图,求 s 到 t 的最短路。solutionSPFA模板codes#include#include#include#define maxn 2500+10#define maxm 6200+10using namespace ... 阅读全文
posted @ 2018-06-01 13:28 gwj1139177410 阅读(207) 评论(0) 推荐(0)
摘要: problemsolutioncodes#include #include #include #include using namespace std;const int M=505;int n,la,lb,a[M],b[M],ans=0;int f[M];void ... 阅读全文
posted @ 2018-05-31 21:45 gwj1139177410 阅读(154) 评论(0) 推荐(0)
摘要: problemsolutioncodes//vijos 1180#include#includeusing namespace std;struct Edge { int w; vectorto; }G[1010];int f[1010][1010];//dfs(x... 阅读全文
posted @ 2018-05-31 21:43 gwj1139177410 阅读(177) 评论(0) 推荐(0)
摘要: problemsolutioncodes#include#includeusing namespace std;struct side{ int u, v, w; }e[10010];bool cmp(const side &a, const side &b){ re... 阅读全文
posted @ 2018-05-31 21:42 gwj1139177410 阅读(110) 评论(0) 推荐(0)
摘要: problemsolutioncodes//vijos1790//拓扑排序的本质是本次将入度为0的点排到序列的最前端。#include#include#include#define maxn 100000+10using namespace std;int n, m,... 阅读全文
posted @ 2018-05-31 21:40 gwj1139177410 阅读(166) 评论(0) 推荐(0)
摘要: problem一条路上有n个教学评估团,对于每个评估团从s开始每d个站一个人直到e结束现在要找到一个站的人数是奇数的点,这个点可能没有,且至多只有一个问这个点在哪以及这个点站了多少人solution因为最多只有一个点是奇数,所以很显然会想到奇数+偶数=奇数,所以说明这... 阅读全文
posted @ 2018-05-31 21:37 gwj1139177410 阅读(165) 评论(0) 推荐(0)
摘要: problem给定n个人朋友的朋友是朋友,敌人的敌人是朋友朋友之间组成一个团伙,求团伙数solution将每个点x拆成两个:x和x+n(分别表示x的朋友和敌人)如果x和y是朋友,就将x和y合并如果x和y是敌人,就将x和y+n合并,将y和x+n合并注意朋友的敌人不一定是... 阅读全文
posted @ 2018-05-31 15:28 gwj1139177410 阅读(150) 评论(0) 推荐(0)
摘要: 1、二分的基本用法是在单调序列或单调函数中进行查找。 2、当问题的答案具有单调性时,就可以通过二分把求解转化为判定(判定一般比求解容易实现。A基本用法(这里都是个人写法,可以跳过1、整数域1)原则最终答案处于闭区间[l,r]内循环以l==r结束每次二分中间值mid归属... 阅读全文
posted @ 2018-05-31 13:21 gwj1139177410 阅读(157) 评论(0) 推荐(0)
摘要: problemsolutioncodes#includeusing namespace std;int n, c[20];void dfs(int cur){ if(cur == n){ for(int i = 0; i >n; dfs(0)... 阅读全文
posted @ 2018-05-31 12:56 gwj1139177410 阅读(103) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 50 下一页
选择