2016-2017 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2016)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2016-2017 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2016)相关的知识,希望对你有一定的参考价值。

???????????????   ??????   --   acm-icpc   har   test   push   scan   char   

A - Concerts

?????????dp[i][j]?????????i?????????j??????????????????????????????dp[i][j]=dp[i-1][j]+dp[???h???????????????????????????????????????][j-1]???

#include<bits/stdc++.h>
using namespace std;
int h[300];
char plan[305],schedule[100005];
int k,n;
int dp[100005][305];
const int mod=1e9+7;
int main()
{
    while(~scanf("%d%d",&k,&n))
    {
        for(int i=???A???;i<=???Z???;++i)scanf("%d",h+i);
        scanf("%s%s",plan,schedule);
        dp[1][1]=(plan[0]==schedule[0]);for(int i=2;i<=n;++i)dp[i][1]=(plan[0]==schedule[i-1])?dp[i-1][1]+1:dp[i-1][1];
        for(int i=2;i<=k;++i)dp[1][i]=0;
        for(int j=2;j<=k;++j)
        {
            for(int i=2;i<=n;++i)
            {
                dp[i][j]=dp[i-1][j];
                if(plan[j-1]==schedule[i-1]&&i-h[plan[j-2]]>=2)dp[i][j]=(1LL*dp[i][j]+dp[i-1-h[plan[j-2]]][j-1])%mod;
            }
        }
        printf("%d
",dp[n][k]);
    }
}

D - Harry Potter and The Vector Spell

??????????????????

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
vector<int> a[maxn];
int n,m;
int fa[maxn];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
int main()
{
    while(~scanf("%d%d",&m,&n))
    {
        for(int i=1;i<=m;++i)
        {
            fa[i]=i;
            int k,tmp;scanf("%d",&k);
            for(int j=1;j<=k;++j)
            {
                scanf("%d",&tmp);
                a[tmp].push_back(i);
            }
        }
        int ans=0;
        for(int i=1;i<=n;++i)
        {
            int u=a[i][0],v=a[i][1];
            int x=find(u),y=find(v);
            if(x!=y){ans++;fa[x]=y;}
        }
        printf("%d
",ans);
    }
}

G - Robots

??????

K - Escape room

??????

以上是关于2016-2017 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2016)的主要内容,如果未能解决你的问题,请参考以下文章

2016-2017 ACM-ICPC CHINA-Final Solution

2016-2017 ACM-ICPC CHINA-Final 个人题解

2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016) 个人题解

2016-2017 ACM-ICPC Northeastern European Regional Contest (NEERC 16)

2016-2017 ACM-ICPC Asia-Bangkok Regional Contest

2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) Solution