摘要: problemsolutioncodes//Floyd-wallshall模板#includeusing namespace std;int n, e[110][110];int main(){ ios::sync_with_stdio(false); c... 阅读全文
posted @ 2018-06-01 21:48 gwj1139177410 阅读(99) 评论(0) 推荐(0)
摘要: problemsolutioncodes//标程Dijkstra#include#include#includeusing namespace std;//Tint n = 60, m, vis[1010];//Graphstruct Edge{ int v, ... 阅读全文
posted @ 2018-06-01 21:32 gwj1139177410 阅读(112) 评论(0) 推荐(0)
摘要: problemsolutioncodes//动态维护大根堆,贪心减少入队元素个数#include#include#includeusing namespace std;const int maxn = 100010;int n, a[maxn], b[maxn];//... 阅读全文
posted @ 2018-06-01 21:30 gwj1139177410 阅读(195) 评论(0) 推荐(0)
摘要: problemsolutioncodes//MST-Kruskal-排序贪心+并查集//题中N=M,(M小于N^2的)稀疏图用邻接表。#include#includeusing namespace std;typedef long long LL;const int ... 阅读全文
posted @ 2018-06-01 21:27 gwj1139177410 阅读(150) 评论(0) 推荐(0)
摘要: problemsolutioncodes//MST-Prim-贪心-堆优化#include#include#includeusing namespace std;const int maxn = 110;//Graphint e[maxn][maxn],ans;//P... 阅读全文
posted @ 2018-06-01 21:23 gwj1139177410 阅读(144) 评论(0) 推荐(0)
摘要: problemsolutioncodes#includeusing namespace std;int main(){ int n, k=1; cin>>n; //1.第n个数在第k条斜线上(前k条斜线的数的个数为等差数列) while((1+k)... 阅读全文
posted @ 2018-06-01 21:20 gwj1139177410 阅读(198) 评论(0) 推荐(0)
摘要: problemsolutioncodes#includeusing namespace std;int n, a[1010], t;int main(){ cin>>n; for(int i = 1; i >x; if(!a[x]){ a[x... 阅读全文
posted @ 2018-06-01 21:18 gwj1139177410 阅读(182) 评论(0) 推荐(0)
摘要: problemsolutioncodes#includeusing namespace std;const int maxn = 1010;int f[maxn];int main(){ int n; cin>>n; for(int i = 1; i <... 阅读全文
posted @ 2018-06-01 21:16 gwj1139177410 阅读(149) 评论(0) 推荐(0)
摘要: 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)
选择