随笔分类 -  奇葩

摘要:这没什么好讲的,都是套路。 话说我的代码在本地跑得贼慢,我还以为会TLE,然后发现时限有4s 看代码: #include<bits/stdc++.h> using namespace std; const int maxn=5*1e6+10; int f[maxn],a[maxn],n,m; int 阅读全文
posted @ 2020-03-17 17:25 syzf2222 阅读(195) 评论(0) 推荐(0) 编辑
摘要:请点这里,我实在是懒得复制粘贴了。 阅读全文
posted @ 2020-03-17 16:47 syzf2222 阅读(79) 评论(0) 推荐(0) 编辑
摘要:这是树上待修莫队的裸题。 可是我已开始应为吧cmp写错了TLE成30,呜呜…… 看代码: #include<bits/stdc++.h> using namespace std; #define int long long const int maxn=1e5+10; int n,m,q,a[max 阅读全文
posted @ 2020-03-16 14:11 syzf2222 阅读(168) 评论(0) 推荐(0) 编辑
摘要:这题在修改的时候略有不同,应当减去之前的贡献再加上此时的贡献。 就像这样: void add(int x){ now=now+2*cnt[a[x]]+1; cnt[a[x]]++; } void del(int x){ cnt[a[x]]--; now=now-2*cnt[a[x]]-1; } 那么 阅读全文
posted @ 2020-03-11 22:12 syzf2222 阅读(109) 评论(0) 推荐(0) 编辑
摘要:这几乎就是莫队板子。 是否互不相同等价于判断 now==q[i].r-q[i].l+1 。 看代码: #include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; int n,m,a[maxn],cnt[maxn],ans[m 阅读全文
posted @ 2020-03-11 22:09 syzf2222 阅读(139) 评论(0) 推荐(0) 编辑
摘要:如果要学习莫队算法请另寻别处。 但是这里可以为您提供高质量的练习题配代码。 代码如下: #include<bits/stdc++.h> using namespace std; const int maxn=1e6+10; struct node{ int l,r,bl,br,id; }q[maxn 阅读全文
posted @ 2020-03-11 22:07 syzf2222 阅读(204) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示