摘要: #include<bits/stdc++.h> using namespace std; const int N = 300010; vector<int>p[N]; int ans[N]; int main() { int t; scanf("%d",&t); while(t --) { int 阅读全文
posted @ 2020-10-02 19:31 想拿牌想考研的菜鸡 阅读(208) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N = 2000010; typedef long long LL; int n; //t[i]表示树状数组i结点覆盖的范围 阅读全文
posted @ 2020-08-30 20:35 想拿牌想考研的菜鸡 阅读(131) 评论(0) 推荐(0) 编辑
摘要: //这是一题无向图的题目。#include<bits/stdc++.h> using namespace std; const int N = 750005; int n,q; int h[N],ne[2*N],idx,e[2*N];//无向图记得开二倍int dp[N][3]; void add( 阅读全文
posted @ 2020-04-15 20:23 想拿牌想考研的菜鸡 阅读(168) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; const int N = 10001; int a[N]; int tree[N*2]; build_tree(int a[],int tree[],int node,int start,int end1) 阅读全文
posted @ 2020-03-29 02:27 想拿牌想考研的菜鸡 阅读(118) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; const int N=1e5+5; int a[N][26]; //因为这题是小写的26个字母,所以我们二维写的便是26; int idx; //idx用来统计新出现的节点的个数。 int cnt[N]; / 阅读全文
posted @ 2020-02-29 17:09 想拿牌想考研的菜鸡 阅读(191) 评论(0) 推荐(0) 编辑
摘要: (kmp) O(n+m)O(n+m) kmp下标从1开始的话容易思考些。 先理解匹配数组 ababa的前缀为a,ab,aba,abab, 后缀为 a, ba, aba, baba, 前后缀都不包含自身 那么匹配数组ne[1..5]为 0 0 1 2 3 ne[1] = 0表示没有前后缀(因为前后缀不 阅读全文
posted @ 2020-02-29 17:05 想拿牌想考研的菜鸡 阅读(143) 评论(0) 推荐(0) 编辑
摘要: AcWing 830. 单调栈 思路是让这题变成一个单调递增的数列,若新出现的一个数比前面的数小,那么就逐个覆盖。每次输出栈尾就是左边不大于他的第一个数。 #include<iostream> using namespace std; const int N =100010; int tt=0; i 阅读全文
posted @ 2020-02-27 02:35 想拿牌想考研的菜鸡 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 今天我们讲的双链表和单链表是用数组的形式进行的。 也就是用邻接表的形式完成的。 #include<bits/stdc++.h> using namespace std; const int N =100010; char cp; int x,k; int idx,head; int a[N],Nex 阅读全文
posted @ 2020-02-26 23:39 想拿牌想考研的菜鸡 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<algorithm> using namespace std; typedef pair<int, int> PII; int n; void merge(vector<PII> &interval) { ve 阅读全文
posted @ 2020-02-23 01:58 想拿牌想考研的菜鸡 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目描述首先明确一下题意,先输入两个整数n、m,n代表在区间[-1e9,1e9]某一点加一个整数的次数,输入x c在x处加上c,m代表求某个区间和的次数,输入l r求区间[l,r]的和。 分析分析一下y总的代码。 主要分为5大步:1.读输入。将每次读入的x c push_back()到add中,将每 阅读全文
posted @ 2020-02-23 01:46 想拿牌想考研的菜鸡 阅读(253) 评论(0) 推荐(0) 编辑