http://www.lydsy.com/JudgeOnline/problem.php?id=1047 先用单调队列求出每横着n个最大值 再在里面用单调队列求出每竖着n个的最大值 这样一个位置就代表了一个n*n矩阵的最大值 同理求出最小值 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define N 1001 int num[N][N]; int mx1[N…
http://www.lydsy.com/JudgeOnline/problem.php?id=1053 求n以内约数个数最多的数 #include<cstdio> using namespace std; int n; int ans; long long tot; ]={,,,,,,,,,,}; void dfs(int now,long long sum,long long num) { ) return; if(sum>tot || sum==tot && num…
https://www.lydsy.com/JudgeOnline/problem.php?id=3676 回文自动机模板题 4年前的APIO如今竟沦为模板,,,╮(╯▽╰)╭,唉 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define N 300001 char ss[N]; int s[N]; ,last; int fail[N],len[N],cnt[N…