
排序综合
文章平均质量分 81
_rhinoceros_
非淡泊无以明志,非宁静无以致远。
展开
-
AtCoder ABC001D - 感雨時刻の整理 题解及翻译(差分,排序,占位输出方式)
给定一个变量 m, 之后是 m 组时间段以“时分-时分”给出要求将其转化之后再合并转化方式为,起始时间向前移动到能被5整除,结束时间向后移动到能被5整除,如:1148-1210转化为1145-1210合并方式为,将重复的时间段合并。原创 2023-09-17 09:05:58 · 266 阅读 · 0 评论 -
(拓扑排序)UVa 10305给任务排序(紫书代码解释)
一、代码及注释 #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; const int maxn=1050; int G[maxn][maxn]; int c[maxn]; int ans[maxn]; int n...原创 2019-12-19 23:13:19 · 219 阅读 · 0 评论 -
拓扑排序-Uva10305 给任务排序 题解(第一节 dfs解法)
一、拓扑排序 对一个有向无环图(Directed Acyclic Graph简称DAG)G进行拓扑排序,是将G中所有顶点排成一个线性序列,使得图中任意一对顶点u和v,若边<u,v>∈E(G),则u在线性序列中出现在v之前。通常,这样的线性序列称为满足拓扑次序(Topological Order)的序列,简称拓扑序列。简单的说,由某个集合上的一个偏序得到该集合上的一个全序,这个操作称之为...原创 2019-11-26 03:22:18 · 285 阅读 · 0 评论 -
排序综合-UVA120 煎饼 Stacks of Flapjacks题解(采用STL)
一、算法分析 首先看到这个题,就要想到对子序列进行排序的做法。那么解题思路就比较清晰了,即先找到子序列,再用题上特有的操作(翻面法),将子序列排序。具体做法如下例所示: 2 4 1 5 3 6 5 1 4 2 3 6 3 2 4 1 5 6 4 2 3 1 5 6 1 3 2 4 5 6 3 1 2 4 5 6 2 1 3 4 5 6 1 2 3 4 5 6 分析:①将数组进行排序,本例排序结果为...原创 2019-12-01 18:42:02 · 213 阅读 · 0 评论 -
排序-洛谷P1583魔法照片
题目链接 题目戳这里 代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=20005; struct stu{ //其实核心就...原创 2019-11-18 04:08:20 · 185 阅读 · 0 评论