摘要:
二分水题,A,B,C三个数组排序,对于每个B[i],二分算出来有多少A比他小,多少C比他大,然后扫一遍出结果。O(nlog(n))水过。 include using namespace std; const int MAXN = 1e5+10; int A[MAXN],B[MAXN],C[MAXN] 阅读全文
摘要:
除非人品好,能碰巧想到思路,否则基本是做不出来dp的,除了那几个经典的dp模型。。 看了几个前几名的代码,还是t神的代码比较清晰。膜tourist 代码的思路和题解思路基本一致。。。。。 include using namespace std; const int MAXN = 1234567; c 阅读全文
摘要:
这么小的数据范围。暴力啊。不幸的是。暴力都写错了。。。写的O(n^2)的,看了下别人的代码,大都是O(n^3)的,最无耻的是题解,竟然是O(n^5) 数据范围小也不能这样啊 include using namespace std; using LL = long long; const int MA 阅读全文
摘要:
求割边个数。Tarjan的板子。。 include using namespace std; const int MAXN = 55; const int MAXM = 500; struct Edge { int to,next; }edge[MAXM]; int head[MAXN],tot; 阅读全文