题解:想象两只蚂蚁相遇后朝反方向走,如果无视不同蚂蚁的区别,可以认为是保持原样交错通过继续前进不会有任何问题,可 以认为蚂蚁是独立运动,求最长时间就是求蚂蚁到杆子端点的最大距离,求最短时间就是求蚂蚁到杆子端点的最短距离。 时间复杂度 O( n ) #include <iostream> #inclu ...
分类:
其他好文 时间:
2020-02-01 23:04:28
阅读次数:
78
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; const int N=10010<<1; struct node { int l,r,ans; } q[N]; int a[N],fa[N],d ...
分类:
其他好文 时间:
2020-02-01 21:18:27
阅读次数:
74
#include<iostream> #include<cmath> using namespace std; const int N=1010; int dx[N],dy[N]; int p[N]; int repair[N]; int n; int d; double get(int a,int ...
分类:
Web程序 时间:
2020-02-01 16:30:31
阅读次数:
97
#include<iostream> using namespace std; const int N=30010; int n,m,ans,p[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x]); return p[x]; } int main() ...
分类:
其他好文 时间:
2020-02-01 16:15:56
阅读次数:
50
#include<iostream> #include<cstdio> using namespace std; const int N=100010; int p[N]; int d[N]; int find(int x) { if(p[x]!=x) { int u=find(p[x]); d[x ...
分类:
其他好文 时间:
2020-02-01 16:15:15
阅读次数:
47
图书简介 实用性是本书的第一个基本出发点,书中介绍了近年来在工业界被广泛应 用的机器学习算法,这些算法经受了时间的考验,不但效果好而且使用方便。此 外作者也十分注意理论的深度和完整性,组织各章节的内容时力求由浅入深、推 理完整、先后连贯、自成体系,先讲统计学、矩阵、优化方法这些基础知识,再 由简到繁 ...
分类:
编程语言 时间:
2020-02-01 12:34:19
阅读次数:
79
定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要 ...
分类:
其他好文 时间:
2020-02-01 12:30:41
阅读次数:
74
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<queue> 5 #include<map> 6 #include<vector> 7 #include<set> 8 #include<string> ...
分类:
其他好文 时间:
2020-01-31 18:49:43
阅读次数:
71
这道题就是单调队列的裸题 今天刚学的单调队列 前几天刚学习完单调栈 感觉这两个东西非常相似哇 黄哥的一句话说破了他 他俩的区别就像队列和栈的区别233333 有关这道题倒没有太多说的 就是模拟队列 单调递增递减来找到区间最值 我这里用了数组模拟 问题就是G++ T了/// 而C++ AC 就很迷。。 ...
分类:
其他好文 时间:
2020-01-31 18:32:19
阅读次数:
79
// #include<iostream> #include<cstring> #include<queue> #include<stack> #include<stdio.h> using namespace std; const int INF=0x3f3f3f3f; const int N=3 ...
分类:
其他好文 时间:
2020-01-31 16:01:31
阅读次数:
71