AcWing 796. 子矩阵的和 #include <bits/stdc++.h> using namespace std; const int N=1e3+10; int a[N][N],S[N][N]; int main(){ int n,m,q; scanf("%d%d%d",&n,&m,& ...
AcWing 797. 差分 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int a[N],b[N]; void insert(int l,int r,int c){ b[l]+=c; b[r+1]-=c; } ...
AcWing 798. 差分矩阵 #include <bits/stdc++.h> using namespace std; const int N=1e3+10; int a[N][N],b[N][N]; void insert(int x1,int y1,int x2,int y2,int c) ...
AcWing 799. 最长连续不重复子序列 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int a[N],s[N]; int main(){ int n; cin>>n; for(int i=0;i<n;i++ ...
AcWing 801. 二进制中1的个数 #include <bits/stdc++.h> using namespace std; int lowbit(int x){ return x&-x; } int main(){ int n; cin>>n; while(n--){ int x,res= ...
AcWing 793. 高精度乘法 #include <bits/stdc++.h> using namespace std; vector<int> mul(vector<int> &A,int b){ int t=0; vector<int> C; for(int i=0;i<A.size()| ...
:将每行输入的数字转换为十进制,然后预处理出所有满足题意的状态并存储于 sta ,再处理出单独一行时候的方案数并存储于 dp1,sta 枚举第 i 行的状态,判断第 j = i-1行的状态,并更新dpi , j ,最后累和即可 #include <bits/stdc++.h> using names ...
分类:
其他好文 时间:
2020-07-28 14:10:58
阅读次数:
62
题意 小明从一岸游泳到另一岸,每片区域有水深,一旦水深超过L,小明就会淹死 同时每段时刻有海浪和退潮 搜索一下 然后记忆化一下 老了,搜索写半天 #include<bits/stdc++.h> using namespace std; /*int main() { // freopen("data2 ...
分类:
其他好文 时间:
2020-07-27 23:58:02
阅读次数:
127
#include<bits/stdc++.h> using namespace std; #define int long long namespace yspm{ inline int read() { int res=0,f=1; char k; while(!isdigit(k=getchar ...
分类:
其他好文 时间:
2020-07-27 23:34:24
阅读次数:
65
dfs连通性模型 1. 算法分析 使用dfs来判断是否两个点连通,也可以通过dfs来做计数 2. 例题 acwing1112迷宫 T个测试样例,每个测试样例输入一个N,表示网格大小。网格为N*N的二维网格,给定起点和终点,问起点能否到达终点 #include <bits/stdc++.h> usin ...
分类:
其他好文 时间:
2020-07-27 13:38:39
阅读次数:
73