04 2020 档案
摘要:``` //序列具有周期性 #include #include #include #include using namespace std; typedef long long ll; const int N=5e4+10; ll sum[N]; ll a,b,q; ll calc(ll x) { return x/(a*b)*sum[a*b]+1ll*sum[x%(a*b)]; } void s
阅读全文
摘要:参考博客:https://blog.csdn.net/qq_45458915/article/details/105730195 构造nb
阅读全文
摘要:``` #include #include #include #include #include #include using namespace std; typedef long long ll; const int N=10010,M=1010; int n,m; int g,r; //定义d[i,j]为到了第i个站点时,绿灯当前时间为j,经过了多少轮红绿灯变换。 int d[N][M];
阅读全文
摘要:``` #include #include #include #include using namespace std; #define int long long const int N=4e6+10; int e[N],ne[N],h[N],idx; int depth[N]; int ans[N]; int size[N]; int n; char buf[1'9') { if(ch=='-
阅读全文
摘要:``` #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; const int inf = 0x3f3f3f3f; const int N = 2e3 + 10; string ss[10] = {"1110111", "0010
阅读全文
摘要:``` #include #include #include #include using namespace std; const int N = 1010; int k, n, m, S, E; //距离 int g[N][N]; int res[N][N]; void mul(int c[][N], int a[][N], int b[][N]) { static int temp[N][N
阅读全文
摘要:``` //无论a到b 和 b到c 有没有重合 //都可以写为 //a->x->b->x->c #include #include #include #include #include using namespace std; typedef long long ll; char buf[1'9') { if(ch=='-')f=-1; ch=getc(); } while(ch>='0'&&ch
阅读全文
摘要:参考博客:https://www.luogu.com.cn/blog/Sooke/solution p5017
阅读全文
摘要:```#include #include #include #include #include #include using namespace std;const int N = 2e3;int n, arr[N + 5], cnt[N + 5], maxv;vector> res;vector ans;//现在多少数//最大是多少void solve(int u, int maxnow){ i...
阅读全文
摘要:```#includeusing namespace std;int a[8][8],len[12],cnt;int d[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};bool vis[8][8];bool check(int x,int y){ return x>=1&&x=1&&ymxdep) return false; //如果长度恰好等于股价函数 ,也就是到了边缘...
阅读全文
摘要:补题,参考博客:https://blog.csdn.net/qq_43676357/article/details/105559491?fps=1&locationNum=2
阅读全文
摘要:``` #include #include #include #include using namespace std; const int N = 2e5+10; typedef long long ll; ll t, n1, n2, n3; ll a[N], b[N], c[N]; //分别固定一个数 设为a[i] //然后从 b 和 c 中找一个小于等于他的 和 一个大于等于他的 //然后枚
阅读全文
摘要:补题 参考:https://blog.csdn.net/weixin_45750972/article/details/105523046
阅读全文
摘要:``` //#include #include #include #include #include #include #include #define int long long using namespace std; #define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii; typedef unsigned long long ull;
阅读全文
摘要:``` #include #include #include #include #include #include using namespace std; const int N=3e5+10; int n,p[N],du[N],dis[N]; bool F[N]; paire[N]; vector> G[N]; int vis[3]; int minv,maxv; void init() {
阅读全文
摘要:``` //四进制下的表 //001 002 003 //1行 第一段 //010 020 030 //011 022 033 //012 023 031 //013 021 032 //4行 第二段 //100 200 300 //101 202 303 //102 203 301 //103 201 302 //110 220 330 //111 222 333 //112 223 331 /
阅读全文
摘要:```//#include#include#include#include#include#include#include#define int long longusing namespace std;#define rep_1(i,m,n) for(int i=m;i='0'&&ch='0'&&ch pii;typedef unsigned long long ull;typedef pair...
阅读全文
摘要:非常难受的是,我用链表写的,要么wa,要么tle,甚至还出现了超内存。。。 然后换成矩阵,开始还是wa了两次,然后换了别的快读,才过,难受。
阅读全文
摘要:``` #include #include #include #include #include #include using namespace std; #define ll long long const int N=1e5+5; const int M=1e5+5; const int INF=0x3f3f3f3f; int read() { int res=0,ch,flag=0; if
阅读全文
摘要:``` #include #define f first #define s second using namespace std; typedef long long ll; const int N=300005; typedef pair P; int n,tot,t,V; map mp; map,int> mp2; vector G[N]; int match[N]; bool used[N
阅读全文
摘要:```#include#includeusing namespace std;typedef long long ll;int read(){ int temp=0,ch,flag=0; if((ch=getchar())=='-') //判断正负 flag=1; else if(ch>='0'&&ch='0'&&ch>str+1>>m; n=strlen(str+1);...
阅读全文
摘要:```#include#include#include#include#include#includeusing namespace std;typedef long long ll;int read(){ int res=0,ch,flag=0; if((ch=getchar())=='-') //判断正负 flag=1; else if(ch>='0'&&ch='0'...
阅读全文
摘要:```#include#include#define int long longusing namespace std;const int N=4010,mod=1e9+7;int a[N];int e[N*N],ne[N*N],idx,h[N];int st[N];int ans;int ans1[N];int read(){ int res=0,ch,flag=0; if((ch=getcha...
阅读全文
摘要:```#include#include#include#include#include#includeusing namespace std;#define LL long longconst int N=1010;int val[N][N];int res[N][N];char c[N][N];int n,m;bool check(int mid){ memset(res,0,sizeof re...
阅读全文
摘要:参考博客:https://www.acwing.com/solution/AcWing/content/826/
阅读全文
摘要:``` #include #include #include #include using namespace std; const int N=8e5+5; int maxx=-0x3f3f3f3f; int n; int f[N]; struct node{ int s,f; } cow[405]; int main() { cin>>n; for(int i=1;i>cow[i].s>>co
阅读全文