日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ssl提高组周二备考赛【2018.10.30】

發布時間:2023/12/3 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ssl提高组周二备考赛【2018.10.30】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言

依舊想去德育基地…


成績

RankRankRankPersonPersonPersonScoreScoreScoreAAABBBCCC
1112017xxy2017xxy2017xxy210210210404040100100100707070
2222017myself2017myself2017myself190190190202020100100100707070
3332017lxf2017lxf2017lxf180180180000909090909090
4442017zyc2017zyc2017zyc170170170000100100100707070
5552017zyx2017zyx2017zyx150150150404040606060505050
6662017xjq2017xjq2017xjq130130130000100100100303030
7772017lrz2017lrz2017lrz100100100101010909090000
7772013lyk2013lyk2013lyk100100100000100100100000
9992015zyf2015zyf2015zyf909090202020000707070
1010102013lxh2013lxh2013lxh909090000909090000

正題


T1:nssl1254?A(T1:nssl1254-A(T1:nssl1254?A(林下風氣)))【樹形dpdpdp

博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83541098


T2:nssl1255?B(T2:nssl1255-B(T2:nssl1255?B(輕功)))SPFA,SPFA,SPFA,分層圖】

博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83541258


T3:nssl1256?C(T3:nssl1256-C(T3:nssl1256?C(盟主的憂慮)))【并查集】

博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/83541476


someofcodesome\ of\ codesome?of?code


T2 20分code

#include<cstdio> #include<cstring> #include<algorithm> #define N 4000 #define XJQ 19260817 using namespace std; struct node{int to,next; }a[N]; int ls[N],w[N],maxs,mins,ans,n,k,tot,x,y,in[N]; void addl(int x,int y) {a[++tot].to=y;a[tot].next=ls[x];ls[x]=tot; } void dp1() {for(int i=1;i<=n;i++){maxs=0;mins=2147483647;for(int j=i;j<=n;j++){maxs=max(maxs,w[j]);mins=min(mins,w[j]);if(maxs-mins==k) ans++;}}printf("%d",ans); } int main() {scanf("%d%d",&n,&k);for(int i=1;i<=n;i++)scanf("%d",&w[i]);for(int i=1;i<n;i++){scanf("%d%d",&x,&y);addl(x,y);addl(y,x);in[x]++;in[y]++;maxs=max(maxs,max(in[x],in[y]));}if(maxs<=2)dp1();else printf("0"); }

T3 70分code

#include<cstdio> #include<algorithm> #define N 100010 using namespace std; struct node{int to,w,next,from; }a[N]; int ls[N],tot,x,y,w,ans,dep[N],n,m,S,dfn[N],end[N],cnt; void addl(int x,int y,int w) {a[++tot].to=y;a[tot].w=w;a[tot].next=ls[x];ls[x]=tot;a[tot].from=x; } void dfs(int x,int fa) {dfn[x]=++cnt;dep[x]=dep[fa]+1;for(int i=ls[x];i;i=a[i].next)if(i<S){int y=a[i].to;if(y==fa) continue;dfs(y,x);}end[x]=cnt; } bool cmp(node x,node y) {return x.from<y.from;} int next(int x) {while(dep[a[x].from]>dep[a[x].to]) x++;return x; } int main() {scanf("%d%d",&n,&m);for(int i=1;i<n;i++){scanf("%d%d",&x,&y);addl(x,y,0);addl(y,x,0);}S=tot+1;for(int i=1;i<=m;i++){scanf("%d%d%d",&x,&y,&w);addl(x,y,w);}dfs(1,0);for(int i=1;i<S;i+=2){ans=2147483647;int x=a[i].to;if(dep[a[i].to]<dep[a[i+1].to]) x=a[i+1].to;for(int j=S;j<=tot;j++)if(dfn[a[j].to]>=dfn[x]&&dfn[a[j].to]<=end[x]&&(dfn[a[j].from]<dfn[x]||dfn[a[j].from]>end[x])||dfn[a[j].from]>=dfn[x]&&dfn[a[j].from]<=end[x]&&(dfn[a[j].to]<dfn[x]||dfn[a[j].to]>end[x]))ans=min(ans,a[j].w);if(ans==2147483647) printf("-1\n");else printf("%d\n",ans);} }

尾聲

話說題目又ABC。老師改題面了

總結

以上是生活随笔為你收集整理的ssl提高组周二备考赛【2018.10.30】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。