2-7 课堂总结
1.图论-二维数组
如何用一个二维数组描述一个图呢?
图的概念:有若干个点,有任意线段连接某两个点。
根据“两个点”可以使用二维数组
如:
4-1---2
| |
| |
5-3----
可以表示为:
1 2 3 4 5
1 0 1 1 1 0
2 1 0 1 0 0
3 1 1 0 0 1
4 1 0 0 0 0
5 1 0 1 0 0
2.勤奋思考
老师说的不一定完全正确,
我们要乐于思考出和老师一样好或更优的方案。
3.louer_bound()和upper_bound()
louer_bound()和upper_bound()使用方法:
louer_bound(a+x,a+y,k)-a;表示从
upper_bound(a+x,a+y,k)-a;表示从
例子:(upper_bound(a+x,a+y,r)-a)-(louer_bound(a+x,a+y,l)-a);表示从
louer_bound()和upper_bound()前需sort。
4.数组映射
处理
int a[1000000010];会RE MLE CE。
int a[1010];,
5.贪心例题
t1:
相当于将
t3:
每遇到
输出