The 2016 ACM-ICPC Asia Shenyang Regional Contest

Posted ruthank

tags:

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

 

 

A. Thickest Burger

大数 × 2 + 小数

#include <cstdio>
#include <algorithm>
using namespace std;

int T;
int A,B;
int main()
{
    scanf("%d",&T);
    for(int t=1; t<=T; t++)
    {
        scanf("%d%d",&A,&B);
        if(A<B) swap(A,B);
        printf("%d
",A*2+B);
    }
    return 0;
}

  

 

 

B. Relative atomic mass

 

 

 

 

C. Recursive sequence

 

 

 

D. Winning an Auction

 

 

 

E. Counting Cliques

爆搜。vector[i] 记录与 i 有边且编号大于的点。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100 + 10;
const int maxm = 1000 + 100;

int n, m, k;
vector<int> v[maxn];
int from[maxm], to[maxm];
int G[maxn][maxn];
int d[maxn], node[maxn];
int tot, ans;

void DFS(int x, int start)
{
    if (tot == k) { ++ans; return; }

    int sz = v[x].size();
    for (int i = start; i < sz; i++)
    {
        int flag = 0;
        for (int j = 2; j <= tot; j++)
        if (!G[ node[j] ][ v[x][i] ]) { flag = 1; break; }

        if (flag) continue;

        node[++tot] = v[x][i], DFS(x, i+1), --tot;
    }
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int ca = 1; ca <= t; ca++)
    {
        memset(d, 0, sizeof(d));
        for (int i = 1; i <= n; i++)
        {
            for (int j = i+1; j <= n; j++) G[i][j] = G[j][i] = 0;
            v[i].clear();
        }

        scanf("%d%d%d", &n, &m, &k);
        for (int i = 1; i <= m; i++)
        {
            scanf("%d%d", &from[i], &to[i]);
            d[ from[i] ]++, d[ to[i] ]++;
        }

        for (int i = 1; i <= m; i++)
            if (d[ from[i] ] >= k-1 && d[ to[i] ] >= k-1)
            {
                if (from[i] < to[i]) v[ from[i] ].push_back(to[i]);
                    else v[ to[i] ].push_back(from[i]);
                G[ from[i] ][ to[i] ] = G[ to[i] ][ from[i] ] = 1;
            }

        ans = 0;
        for (int i = 1; i <= n; i++)
        {
            tot = 1, node[1] = i;
            DFS(i, 0);
        }

        printf("%d
", ans);
    }
}

  

 

 

F. Similar Rotations

 

 

 

G. Do not pour out

 

 

 

H. Guessing the Dice Roll

 

 

 

I. The Elder

 

 

 

J. Query on a graph

 

 

 

K. New Signal Decomposition

 

 

 

L. A Random Turn Connection Game

 

 

 

M. Subsequence

 

以上是关于The 2016 ACM-ICPC Asia Shenyang Regional Contest的主要内容,如果未能解决你的问题,请参考以下文章

The 2016 ACM-ICPC Asia Qingdao Regional Contest

The 2016 ACM-ICPC Asia Qingdao Regional Contest

World Cup(The 2016 ACM-ICPC Asia China-Final Contest dfs搜索)

Number Theory Problem(The 2016 ACM-ICPC Asia China-Final Contest 找规律)

The 2016 ACM-ICPC Asia Beijing Regional Contest E - What a Ridiculous Election

The 2016 ACM-ICPC Asia China-Final Contest Gym - 101194D Ice Cream Tower