做题感悟与有价值的错题整理
\(2026.4.21\)
\(Atcoder\) \(abc454\) \(D\) :应注意位置不同也为不同
\(Atcoder\) \(abc454\) \(E\) :网格图常见操作:黑白染色\((\forall (i,j) \in G,f(i,j)=\begin{cases}
1 &\ i+j=2k,k\in \mathbb Z\\
0 &\ i+j=2k+1,k\in \mathbb Z\\
\end{cases})\)
\(Luogu\) \(P2758\) :求解\(LCS\)用\(max(n,m)-Len[LCS]\) 不可行
因为:\(aaabb\) \(baaab\)
\(LCS:4\)
实际需要\(2\)步
\(Luogu\) \(P1874\) 超实用的技巧,写\(dfs\)时维护变量\(cnt\),\(cnt>=2e8\)时跳出输出无解
\(Atcoder\) \(abc457\) \(D\) 如果求最大的最小值,使用
while(l<r){
mid=l+r+1>>1;
if(check(mid)) l=mid;
else r=mid-1;
}
\(2026.5.22\)
恒等式
\(A+B=A\oplus B+2A\& B\)
\(2026.5.26\)
如果堆内想让后来的放在后面,可以加入时间戳
struct node{//以大根堆,后进在后面为例
int id,k,tag;
bool operator <(node x) const{
if(k!=x.k) return k<x.k;
else return tag>x.tag;//引入副排序参数timetag
}
};
对于一个严格单调递增的序列\(A\)可将其替换为\(A_i\rightarrow A_i-i\)这样问题转化为使其单调不下降
\(2026.6.4\)
假设树上有一条直径\((u,v)\)还有一条非直径路径\((u',v')\)交于点\(\phi\),有\(\forall p
,max(d(\phi,u'),d(\phi,v'))\leq min(d(\phi,u),d(\phi,v))\)
posted on 2026-04-21 14:19 Underthetwilight 阅读(12) 评论(0) 收藏 举报
浙公网安备 33010602011771号