• 2024-01-14abc098d<双指针,异或>
    题目D-XorSum2给出n个元素的数组a,求满足条件的子区间个数:数组a子区间元素和与异或和相等。思路和与异或和相同,即没有任何进位,也就是区间中对于范围内每个二进制位,最多出现一次;使用双指针,统计每个二进制位最多出现一次的区间个数即可;总结异或:不进位加法;代码点击
  • 2023-07-30abc312d <dp, 括号匹配方案数>
    题目D-CountBracketSequences思路dp[i][j]为考虑前\(i\)个位置,待匹配的(有\(j\)个的方案数;代码点击查看代码#include<iostream>#include<algorithm>#include<vector>#include<cstring>usingnamespacestd;usingLL=longlong;usingPII=pair<
  • 2023-07-20abc090d <枚举计数>
    题目D-RemainderReminder代码Code//https://atcoder.jp/contests/abc090/tasks/arc091_b#include<iostream>#include<algorithm>#include<vector>#include<cstring>usingnamespacestd;usingLL=longlong;usingPII=pair<in
  • 2023-07-17abc310e <公式递推(dp?)>
    题目E-NANDrepeatedly思路总结公式递推,找到相邻两项间的关系;代码Code#include<iostream>#include<algorithm>#include<vector>#include<cstring>usingnamespacestd;usingLL=longlong;usingPII=pair<int,int>;constintN=1e
  • 2023-07-12newcoder61132F <结论:排序最小交换次数>
    题目松鼠排序n个不同的数,任意交换位置进行排序,其最小交换次数。思路结论:\(最小交换次数=n-r\),其中\(r\)为置换环个数。参考:https://www.cnblogs.com/CDOI-24374/p/16410082.html代码Code#include<iostream>#include<algorithm>#include<vector>#include<cstrin
  • 2023-07-12abc080d <区间重叠>
    D-Recording//https://atcoder.jp/contests/abc080/tasks/abc080_d#include<iostream>#include<algorithm>usingnamespacestd;usingLL=longlong;constintN=1e5+10;inta[N][31];voidsolv(){intn,m;cin>>n>&g
  • 2023-07-10abc073d <Floyed + 枚举排列>
    D-joisino'stravel//https://atcoder.jp/contests/abc073/tasks/abc073_d//Floyed+枚举排列#include<iostream>#include<algorithm>#include<vector>#include<cstring>usingnamespacestd;usingLL=longlong;constintN=
  • 2023-06-23abc059d <博弈, 打表找规律>
    D-Alice&Brown如何打表要善于通过打表展示视觉信息,从而找到规律;#include<iostream>#include<algorithm>usingnamespacestd;typedeflonglongLL;intf[100][100];//0未定,1win,2lose//注意这里找先手必胜与必负的方式//当我的可以转移到任何一个必输态