luoguP4396 [AHOI2013]作业】的更多相关文章

https://www.luogu.org/problemnew/show/P4396 简单的莫队+树状数组,但博主被卡常了,不保证代码在任何时候都能AC #include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &f) { f = 0; T fu = 1; char c = getchar(); while (c < '0' || c > '9'…
3236: [Ahoi2013]作业 Time Limit: 100 Sec  Memory Limit: 512 MBSubmit: 1393  Solved: 562[Submit][Status][Discuss] Description Input Output Sample Input 3 4 1 2 2 1 2 1 3 1 2 1 1 1 3 1 3 2 3 2 3 Sample Output 2 2 1 1 3 2 2 1 HINT N=100000,M=1000000 Sourc…
[原题1] 3110: [Zjoi2013]K大数查询 Time Limit: 20 Sec  Memory Limit: 512 MB Submit: 978  Solved: 476 Description 有N个位置,M个操作.操作有两种,每次操作假设是1 a b c的形式表示在第a个位置到第b个位置,每一个位置增加一个数c 假设是2 a b c形式,表示询问从第a个位置到第b个位置,第C大的数是多少. Input 第一行N.M 接下来M行.每行形如1 a b c或2 a b c Outp…
3236: [Ahoi2013]作业 Time Limit: 100 Sec  Memory Limit: 512 MBSubmit: 1113  Solved: 428[Submit][Status][Discuss] Description Input Output Sample Input 3 4 1 2 2 1 2 1 3 1 2 1 1 1 3 1 3 2 3 2 3 Sample Output 2 2 1 1 3 2 2 1 HINT N=100000,M=1000000 Sourc…
莫队..用两个树状数组计算.时间复杂度应该是O(N1.5logN). 估计我是写残了...跑得很慢... ------------------------------------------------------------------------- #include<bits/stdc++.h>   using namespace std;   #define lowbit(x) ((x) & -(x))   const int maxn = 100009; const int m…
BZOJ_3809_Gty的二逼妹子序列 && BZOJ_3236_[Ahoi2013]作业 _莫队+分块 Description Autumn和Bakser又在研究Gty的妹子序列了!但他们遇到了一个难题. 对于一段妹子们,他们想让你帮忙求出这之内美丽度∈[a,b]的妹子的美丽度的种类数. 为了方便,我们规定妹子们的美丽度全都在[1,n]中. 给定一个长度为n(1<=n<=100000)的正整数序列s(1<=si<=n),对于m(1<=m<=10000…
[Luogu4396][AHOI2013]作业(莫队) 题面 洛谷 题解 模板题 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define MAX 300300 inline int read() { int x=0;bool t=false;char ch=getchar(); while((ch<'0'||ch>'9')&&ch…
[AHOI2013]作业 题目大意: 给定一个长度为\(n(n\le10^5)\)的数列\(A(1\le A_i\le n)\).\(m(m\le10^6)\)次询问,每次询问区间\([l,r]\)内满足\(a\le A_i\le b\)的数有多少,去重后又有多少. 思路: 莫队+分块. 时间复杂度\(\mathcal O(n\sqrt n)\). 源代码: #include<cmath> #include<cstdio> #include<cctype> #inclu…
[BZOJ3809]Gty的二逼妹子序列 Description Autumn和Bakser又在研究Gty的妹子序列了!但他们遇到了一个难题. 对于一段妹子们,他们想让你帮忙求出这之内美丽度∈[a,b]的妹子的美丽度的种类数. 为了方便,我们规定妹子们的美丽度全都在[1,n]中. 给定一个长度为n(1<=n<=100000)的正整数序列s(1<=si<=n),对于m(1<=m<=1000000)次询问“l,r,a,b”,每次输出sl...sr中,权值∈[a,b]的权值的…
BZOJ3236: [AHOI2013]作业 题目描述 传送门 行,我知道是Please contact lydsy2012@163.com! 传送门2 题目分析 这题两问还是非常,emmmm. 首先第一问非常好解决,随便就可以用各种各样的方法求出来. 考虑第二问,明显可以让人想到莫队.通过在颜色上分块就可以快速解决问题. 离散化还是要离散化的,luogu数据比较毒. 是代码呢 #include <bits/stdc++.h> using namespace std; const int MA…