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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

ssl提高组周四备考赛【2018.11.1】

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

前言

呆學校呆4天依舊不想復習期中,期中考涼透了。


成績

RankRankRankPersonPersonPersonScoreScoreScoreAAABBBCCC
1112014lyk2014lyk2014lyk200200200100100100707070303030
2222017wyc2017wyc2017wyc180180180100100100808080000
3332017xjq2017xjq2017xjq170170170100100100707070000
4442014lxf2014lxf2014lxf160160160100100100606060000
5552017lrz2017lrz2017lrz130130130303030100100100000
5552013yhl2013yhl2013yhl130130130100100100303030000
5552015zyf2015zyf2015zyf130130130100100100303030000
8882014lxh2014lxh2014lxh120120120100100100202020000
9992017hzb2017hzb2017hzb110110110303030808080000
1010102014lx2014lx2014lx100100100100100100000000
1010102015gjh2015gjh2015gjh100100100100100100000000
1010102014wwt2014wwt2014wwt100100100100100100000000

正題


T1:nssl1268?T1:nssl1268-T1:nssl1268?可見點數【數論,,,歐拉】

和儀仗隊一樣,就直接放儀仗隊了
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/81071889


T2:nssl1269?T2:nssl1269-T2:nssl1269?射擊【貪心,,,堆】

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


T3:nssl1270?T3:nssl1270-T3:nssl1270?創(chuàng)世紀【樹形dp,dp,dp,基環(huán)樹】

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


someofcodesome\ of\ codesome?of?code


T2 80分code

#include<cstdio> #include<queue> #include<algorithm> #define ll long long #define N 200100 using namespace std; struct node{ll t,w; }a[N]; ll n,last,ans; priority_queue<ll> q; bool cmp(node x,node y) {return x.t==y.t?x.w>y.w:x.t>y.t;} int main() {scanf("%lld",&n);for(ll i=1;i<=n;i++)scanf("%lld%lld",&a[i].t,&a[i].w);sort(a+1,a+1+n,cmp);for(ll i=1;i<=n;i++){q.push(a[i].w);for(ll j=a[i+1].t;j<a[i].t&&!q.empty();j++){ans+=q.top();q.pop();}}printf("%lld",ans); }

T3 0分code

#include<cstdio> #include<algorithm> #include<cstring> #define N 1000010 using namespace std; struct node{int to,next; }a[N]; int n,x,ans,tot,cnt,cr[N],f[N][2],dp[N][2]; int ls[N]; bool v[N],c[N],ic[N]; void addl(int x,int y) {a[++tot].to=y;a[tot].next=ls[x];ls[x]=tot; } void tree_dp(int x) {f[x][1]=2147483647;bool flag=true;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;if(ic[y]) continue;tree_dp(y);flag=false;f[x][0]+=max(f[y][1],f[y][0]);f[x][1]=min(f[x][1],f[y][1]-f[y][0]);}if(flag) f[x][1]=0;f[x][1]=f[x][0]-max(f[x][1],0)+1; } void check() {for(int i=1;i<=cnt;i++)tree_dp(cr[i]);dp[0][0]=dp[0][1]=0;for(int i=1;i<=cnt;i++){dp[i][0]=max(dp[i-1][1],dp[i-1][0])+f[cr[i]][0];dp[i][1]=dp[i-1][0]+f[cr[i]][1];}int maxs=dp[cnt][0];dp[1][0]=f[cr[1]][0];dp[1][1]=0;for(int i=2;i<=cnt;i++){dp[i][0]=max(dp[i-1][1],dp[i-1][0])+f[cr[i]][0];dp[i][1]=dp[i-1][0]+f[cr[i]][1];}maxs=max(maxs,max(dp[cnt][0],dp[cnt][1]));ans+=maxs; } bool check_c(int x) {v[x]=true;c[x]=true;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;if(c[y]||check_c(y)) {ic[x]=true;cr[++cnt]=x;return true;}}return false; } int main() {scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&x);addl(x,i);}for(int i=1;i<=n;i++){if(!v[i]){cnt=0;memset(c,0,sizeof(c));memset(ic,0,sizeof(ic));if(check_c(i))check();}}printf("%d",ans); }

尾聲

沒了

總結

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

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