欢乐纪中某B组赛【2019.1.25】
生活随笔
收集整理的這篇文章主要介紹了
欢乐纪中某B组赛【2019.1.25】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
還算OKOKOK
成績
RankRankRank是有算別人的
| 444 | 2017myself2017myself2017myself | 180180180 | 100100100 | 808080 | 000 |
| 555 | 2017zyc2017zyc2017zyc | 160160160 | 606060 | 100100100 | 000 |
| 111111 | 2017hzb2017hzb2017hzb | 140140140 | 606060 | 808080 | 000 |
| 151515 | 2017xxy2017xxy2017xxy | 115115115 | 151515 | 100100100 | 000 |
| 313131 | 2017xjq2017xjq2017xjq | 100100100 | 000 | 100100100 | 000 |
| 727272 | 2017lw2017lw2017lw | 303030 | 000 | 303030 | 000 |
| 878787 | 2017lrz2017lrz2017lrz | 555 | 000 | 555 | 000 |
| 939393 | 2017hjq2017hjq2017hjq | 000 | 000 | 000 | 000 |
正題
T1:P3365,jzoj3894?T1:P3365,jzoj3894-T1:P3365,jzoj3894?改造二叉樹【LIS,BSTLIS,BSTLIS,BST】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86648465
T2:jzoj3895?T2:jzoj3895-T2:jzoj3895?數字對【RMQ,GCD,RMQ,GCD,RMQ,GCD,二分答案,,,單調隊列】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86648570
T3:jzoj3896?T3:jzoj3896-T3:jzoj3896?戰爭游戲【tarjan,tarjan,tarjan,割點,,,點雙聯通分量】
博客鏈接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86648677
someofcodesome\ of\ codesome?of?code
T2 暴力
#include<cstdio> #include<algorithm> #define N 500010 using namespace std; int n,a[N],maxs,ans[N],tot; int main() {freopen("data.in","r",stdin);freopen("data.ans","w",stdout);scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++)for(int j=i;j<=n;j++)if(j-i>=maxs){int mins=2147483647,flag=true;for(int k=i;k<=j;k++)mins=min(mins,a[k]);for(int k=i;k<=j;k++)if(a[k]%mins){flag=false;break;}if(flag&&j-i>maxs){maxs=j-i;ans[1]=i;tot=1;}else if(flag) ans[++tot]=i;}printf("%d %d\n",tot,maxs);for(int i=1;i<=tot;i++)printf("%d ",ans[i]); }T2 隨機數據
#include<cstdio> #include<cstdlib> #include<ctime> using namespace std; int main() {freopen("data.in","w",stdout);srand(time(0));printf("500\n");for(int i=1;i<=500;i++)printf("%d ",2+rand()%1022); }T3 0分code
#include<cstdio> #include<cstring> #define N 50010 using namespace std; struct node{int to,next; }a[N*4]; int n,m,f[N],v[N],ls[N],tot,ans,s; void addl(int x,int y) {a[++tot].to=y;a[tot].next=ls[x];ls[x]=tot; } int dfs(int x){if(v[x]) return 0;v[x]=true;f[x]=1;for(int i=ls[x];i;i=a[i].next){int y=a[i].to;int k=dfs(y);if(x==s)ans+=f[x]*k;f[x]+=k;}return f[x]; } int main() {freopen("data.in","r",stdin);freopen("data.out","w",stdout);scanf("%d%d",&n,&m);for(int i=1;i<=m;i++){int x,y;scanf("%d%d",&x,&y);addl(x,y);addl(y,x);}for(int i=1;i<=n;i++){memset(v,0,sizeof(v));memset(f,0,sizeof(f));s=i;ans=0;dfs(i);printf("%d\n",ans);} }總結
看題預估分(60+80+0=140)
之后做題預估分(100+80+50=230)
結果(100+80+0=180)炸了
T1:看了會,沒想法。然后去了趟廁所,然后就想到之前看Spaly題解的時候說BST的中序遍歷是單調遞增的,然后就求了一遍LIS求解。
T2:看了會,沒具體想法。然后去了趟廁所,就想到了RMQ可以區間求gcd,結果沒有預處理log就T飛了2個點
T3:最后二十分鐘的時候寫的50分暴力,本來沒打算過樣例,結果過了,然后就測了幾個別的樣例,也過了。結果T飛了
這次還行,沒有翻車
-------------改題分界線-------------
T1:考場AC
T2:加個預處理就A了
T3:tarjan,不就是那個我最不理解的嗎。現在一看好像還挺簡單的。順便把圖論的不足給學了。問題不大
總結
以上是生活随笔為你收集整理的欢乐纪中某B组赛【2019.1.25】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 天涯明月刀傅红雪是谁的儿子 你看过这个电
- 下一篇: 清明节手抄报设计图怎么画