前言
暴力写挂垫底了呀\huge \color{red}\texttt{暴力写挂}\small\color{white}\\\texttt{垫底了呀}暴力写挂垫底了呀
%%%ZZYrank1\texttt{\%\%\% ZZY rank1}%%% ZZY rank1
成绩
JJJ表示初中,HHH表示高中后面加的是几年级
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
111 | (J−3)ZZY(J-3)ZZY(J−3)ZZY | 250250250 | 100100100 | 505050 | 100100100 |
555 | (J−3)WHF(J-3)WHF(J−3)WHF | 200200200 | 000 | 100100100 | 100100100 |
212121 | (J−2)HJQ(J-2)HJQ(J−2)HJQ | 100100100 | 000 | 100100100 | 000 |
282828 | (J−2)ZYC(J-2)ZYC(J−2)ZYC | 808080 | 404040 | 303030 | 101010 |
323232 | (J−2)HZB(J-2)HZB(J−2)HZB | 707070 | 202020 | 505050 | 000 |
323232 | (J−3)QYH(J-3)QYH(J−3)QYH | 707070 | 000 | 000 | 707070 |
373737 | (J−2)LRZ(J-2)LRZ(J−2)LRZ | 505050 | 000 | 505050 | 000 |
505050 | (J−2)WYC(J-2)WYC(J−2)WYC | 303030 | 202020 | 101010 | 000 |
505050 | (J−2)LW(J-2)LW(J−2)LW | 303030 | 000 | 303030 | 000 |
正题
T1:jzoj3360−[NOI2013T1:jzoj3360-[NOI2013T1:jzoj3360−[NOI2013模拟]]]苹果树【树上莫队,LCA,LCA,LCA】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95624497
T2:jzoj3362,bzoj3758−[NOI2013T2:jzoj3362,bzoj3758-[NOI2013T2:jzoj3362,bzoj3758−[NOI2013模拟]]]数数【分段打表,,,背包,,,状压】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95645249
T3:P4556,jzoj3397−[GDOI2014T3:P4556,jzoj3397-[GDOI2014T3:P4556,jzoj3397−[GDOI2014模拟]]]雨天的尾巴【树链剖分,,,线段树】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95635820
someofcodesome\ of\ codesome of code
T120T1\ 20T1 20分codecodecode
#pragma GCC optimize(2)
%:pragma GCC optimize(3)
%:pragma GCC optimize("Ofast")
%:pragma GCC optimize("inline")
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=51000,M=110000;
struct Que_node{int l,r,a,b,id,pos;
}q[M];
struct Edge_node{int to,next;
}a[N*2];
int n,m,c[N],v[N],ls[N],tot,num,ans[M];
int dfn[N],cnt,fa[N],dep[N],rfn[N];
bool operator<(Que_node x,Que_node y)
{return x.pos==y.pos?x.l<y.l:x.pos<y.pos;}
void addl(int x,int y)
{a[++tot].to=y;a[tot].next=ls[x];ls[x]=tot;
}
void dfs(int x,int Fa)
{fa[x]=Fa;dfn[++cnt]=x;rfn[x]=cnt;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;if(y==Fa) continue;dep[y]=dep[x]+1;dfs(y,x);}
}
void add(int x)
{if(!v[x]) num++;v[x]++;}
void del(int x)
{v[x]--;if(!v[x]) num--;}
void LCA(int x,int y)
{if(dep[x]>dep[y]) swap(x,y);while(dep[x]!=dep[y]){add(c[y]);y=fa[y];}while(x!=y){add(c[x]);add(c[y]);x=fa[x];y=fa[y];}add(c[x]);
}
int main()
{scanf("%d%d",&n,&m);for(int i=1;i<=n;i++)scanf("%d",&c[i]);for(int i=1;i<=n;i++){int x,y;scanf("%d%d",&x,&y);addl(x,y);addl(y,x);}dfs(0,0);if(n<=1000&&m<=1000){while(m--){memset(v,0,sizeof(v));int x,y,a,b;scanf("%d%d%d%d",&x,&y,&a,&b);num=0;LCA(x,y);printf("%d\n",num-(v[a]&&v[b])); }return 0;}int t=(int)sqrt(cnt);for(int i=1;i<=m;i++){scanf("%d%d%d%d",&q[i].l,&q[i].r,&q[i].a,&q[i].b);q[i].l=rfn[q[i].l];q[i].r=rfn[q[i].r];if(q[i].r<q[i].l) swap(q[i].l,q[i].r);q[i].id=i;q[i].pos=(q[i].l-1)/t+1;}sort(q+1,q+1+m);int l=1,r=0;for(int i=1;i<=m;i++){while(r<q[i].r) add(c[dfn[++r]]);while(l<q[i].l) del(c[dfn[l++]]);while(l>q[i].l) add(c[dfn[--l]]);while(r>q[i].r) del(c[dfn[r--]]);ans[q[i].id]=num-(v[q[i].a]&&v[q[i].b]);}for(int i=1;i<=m;i++)printf("%d\n",ans[i]);
}
T210T2\ 10T2 10分codecodecode
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int f[81],A,B,num[10],k,a[10];
int dfs(int x,int limst,int sum)
{if(!x){if(sum&1) return 0;int mid=sum/2;f[0]=1;for(int i=1;i<=k;i++)for(int j=mid;j>=a[i];j--)f[j]|=f[j-a[i]];if(f[mid]) return 1;return 0;}int r=limst?num[x]:9,ans=0;for(int i=0;i<=r;i++){a[x]=i;ans+=dfs(x-1,limst&&(i==r),sum+i);}return ans;
}
int solve(int x)
{k=0;while(x){num[++k]=x%10;x/=10;}return dfs(k,1,0);
}
int main()
{scanf("%d%d",&A,&B);printf("%d",solve(B)-solve(A-1));
}
总结
T1T1T1开始以为是树链剖分然后发现不会剖,去看T2T2T2数位dpdpdp直接跳谢谢,然后T3T3T3以为是dusontreedus\ on\ treedus on tree。开始写题,T1T1T1分块显然不行,然后十分显然的树上莫队。但是不会就瞎敲,知道要用欧拉序,但是写了半天自己钦定树上莫队不可做(脑子抽了)。然后去写了三题的暴力。
然后结果就四个字!暴力写挂垫底了呀\huge \color{red}\texttt{暴力写挂}\small\color{white}\\\texttt{垫底了呀}暴力写挂垫底了呀
:<\color{darkblue}\texttt{:<}:<
纪你太美jzojyousobeautiful\huge\\\texttt{\color{lightblue}纪你太美}\large \color{green}\\\texttt{jzoj\ you\ so\ beautiful}纪你太美jzoj you so beautiful