我好菜我好菜我好菜我好菜我好菜
我好菜我好菜我好菜我好菜我好菜
我好菜我好菜我好菜我好菜我好菜
我好菜我好菜我好菜我好菜我好菜
我好菜我好菜我好菜我好菜我好菜
我好菜我好菜我好菜我好菜我好菜
心态大崩
Z Y C d a l a o ZYCdalao ZYCdalao去 A K B AK\ B AK B组了所以应该是我垫底了
话说今天好多暴力都可以 A C AC AC的题目而我还在死刚正解,以后还是得注意了
J J J表示初中, H H H表示高中后面加的是几年级
R a n k Rank Rank | P e r s o n Person Person | S c o r e Score Score | A A A | B B B | C C C |
---|---|---|---|---|---|
3 3 3 | ( J − 3 ) Z Z Y (J-3)ZZY (J−3)ZZY | 263 263 263 | 100 100 100 | 100 100 100 | 63 63 63 |
15 15 15 | ( J − 3 ) W H F (J-3)WHF (J−3)WHF | 140 140 140 | 40 40 40 | 100 100 100 | 0 0 0 |
27 27 27 | ( J − 2 ) L R Z (J-2)LRZ (J−2)LRZ | 100 100 100 | 100 100 100 | 0 0 0 | 0 0 0 |
34 34 34 | ( J − 2 ) X J Q (J-2)XJQ (J−2)XJQ | 85 85 85 | 85 85 85 | 0 0 0 | 0 0 0 |
40 40 40 | ( J − 3 ) Q Y H (J-3)QYH (J−3)QYH | 72 72 72 | 43 43 43 | 24 24 24 | 5 5 5 |
42 42 42 | ( J − 2 ) X X Y (J-2)XXY (J−2)XXY | 66 66 66 | 55 55 55 | 0 0 0 | 11 11 11 |
54 54 54 | ( J − 2 ) L W (J-2)LW (J−2)LW | 33 33 33 | 33 33 33 | 0 0 0 | 0 0 0 |
58 58 58 | ( J − 2 ) H J Q (J-2)HJQ (J−2)HJQ | 26 26 26 | 0 0 0 | 26 26 26 | 0 0 0 |
61 61 61 | ( J − 2 ) H Z B (J-2)HZB (J−2)HZB | 20 20 20 | 20 20 20 | 0 0 0 | 0 0 0 |
64 64 64 | ( J − 2 ) W Y C (J-2)WYC (J−2)WYC | 7 7 7 | 0 0 0 | 7 7 7 | 0 0 0 |
65 65 65 | ( J − 2 ) Z Y C (J-2)ZYC (J−2)ZYC | 6 6 6 | 6 6 6 | 0 0 0 | 0 0 0 |
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95209417
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95209896
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/95210406
#include
#include
#include
#include
using namespace std;
const int N=101000;
int n,tot,ls[N],w[N],num[N],maxs[N],seg[N],cnt;
int ans[N],tail,siz[N],son[N],p[N],id[N],ed[N];
struct Edge_node{
int to,next;
}a[N*2];
struct Tree_node{
int w,l,r,c;
};
vector<int> q[N],c[N];
struct Line_cut_tree{
Tree_node t[N<<2];
void megre(Tree_node &t,Tree_node tl,Tree_node tr){
t.w=tl.w+tr.w;
t.c=max(tl.c,tr.c);
}
void build(int x,int l,int r)
{
t[x].l=l;t[x].r=r;
if(l==r){
t[x].w=0;
t[x].c=0;
return;
}
int mid=(l+r)/2;
build(x*2,l,mid);
build(x*2+1,mid+1,r);
megre(t[x],t[x*2],t[x*2+1]);
}
int Ask(int x,int l,int r)
{
if(t[x].l==l&&t[x].r==r)
return t[x].c;
if(r<=t[x*2].r) return Ask(x*2,l,r);
else if(l>t[x*2].r) return Ask(x*2+1,l,r);
else return max(Ask(x*2,l,t[x*2].r),Ask(x*2+1,t[x*2+1].l,r));
}
void Change(int x,int pos,int z)
{
if(t[x].l==t[x].r){
t[x].w++;t[x].c=z;
return;
}
if(pos<=t[x*2].r) Change(x*2,pos,z);
else if(pos>t[x*2].r) Change(x*2+1,pos,z);
megre(t[x],t[x*2],t[x*2+1]);
}
}Tree;
void addl(int x,int y)
{
a[++tot].to=y;
a[tot].next=ls[x];
ls[x]=tot;
}
void ycl(int x)
{
siz[x]=1;
for(int i=ls[x];i;i=a[i].next)
{
int y=a[i].to;
ycl(y);siz[x]+=siz[y];
if(siz[y]>siz[son[x]]) son[x]=y;
}
}
void dfs(int x,int top)
{
if(!son[x]){
ans[x]=1;
if(top!=x)
Tree.Change(1,w[x],1);
return;
}
id[x]=++cnt;seg[cnt]=x;
for(int i=ls[x];i;i=a[i].next){
int y=a[i].to;
if(y==son[x]) continue;
dfs(y,y);
}
int mid=cnt;
dfs(son[x],x);
for(int i=id[x]+1;i<=mid;i=ed[seg[i]]+1){
for(int j=i;j<=ed[seg[i]];j++){
int z=max(Tree.Ask(1,1,w[seg[j]]),ans[seg[j]]);
Tree.Change(1,w[seg[j]],z);
}
}
int z=Tree.Ask(1,1,w[x]);
ans[x]=z+1;
Tree.Change(1,w[x],z+1);
ed[x]=cnt;
if(top==x)
for(int i=id[x];i<=ed[x];i++)
Tree.Change(1,w[seg[i]],ans[seg[i]]-1);
}
int main()
{
scanf("%d",&n);
Tree.build(1,1,n);
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
if(i==1) continue;
addl(x,i);
}
for(int i=1;i<=n;i++)
scanf("%d",&w[i]);
ycl(1);
dfs(1,1);
for(int i=1;i<=n;i++)
printf("%d ",ans[i]);
}
很烦不想写
最后的最后
❤ 这使你充满了决心 \color{red}\begin{matrix}\huge{❤} \end{matrix}\color{white}\\\texttt{这使你充满了决心} ❤这使你充满了决心