xjtu暑期集训2016-7-9 题解

  • A 郭铮鹏与国际象棋
  • B 郭铮鹏与食堂买饭
  • C 郭铮鹏与烧情侣
  • D 郭铮鹏与线性代数
  • E 郭铮鹏与老司机
  • F GZP and Public Display of Affection
  • G GZP Bureaucracy and Girlfriend
  • H GZP and Dating

A. 郭铮鹏与国际象棋

Description

郭铮鹏正在学习国际象棋。他已经学会了王、车和象的移动方式。国际象棋规则如下:棋盘由8行8列共64个格子组成,一个格子的位置通过数对(r,c)来表示,其中r表示行数c表示列数。

车一次能在水平方向或竖直方向移动任意格.

象一次能在对角线方向移动任意格.

王一次能在任何方向移动一格(水平、竖直或对角线方向)

郭铮鹏掌握了车和王的移动方式,但对于象的移动,他还没有搞清楚。郭铮鹏正在考虑这样的一个问题。一个象从(r1,c1)移动到(r2,c2)的最小移动次数是多少?假定这个棋盘上只有这一个棋子。

注意无解的情况

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
int main(){
//  freopen("a.in.cpp","r",stdin);
    int n;
    cin>>n;
    For(i,n) {
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        if ((a+b)%2!=(c+d)%2) puts("0");
        else if (a-b==c-d||a+b==c+d) puts("1");
        else puts("2");
    }

    return 0;
}

B. 郭铮鹏与食堂买饭

郭铮鹏发现食堂每次买饭都要排很久的队。

现在有N个人在郭铮鹏前面排着队,每个人需要的打饭时间是一个数,郭铮鹏想知道,如果他可以任意改变每个人在队伍中的位置(但不能改变其所需要的打饭时间),那么所有在郭铮鹏前面的人的最少等待时间和。

0 < N < 1000

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
typedef long long ll;
int a[10000];
ll ans=0;
int main(){
//  freopen("b.in.cpp","r",stdin);
    int n;
    scanf("%d",&n);
    For(i,n)
    scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    For(i,n) ans+=(ll)(n-i+1)*a[i];
    cout<<ans<<endl;
    return 0;
}

C. 郭铮鹏与烧情侣

郭铮鹏在的学校里常常弥漫着恋爱的酸臭味,郭铮鹏作为一个热爱和平的FFF成员想知道他至少需要多少桶汽油才能烧完所有的情侣。

假设学校是一个N * M的图(0 < N, M < 1000),每个点如果是1则代表有情侣,如果是0则代表没有情侣。情侣与情侣之间如果是相邻的(即上下左右的关系)那么这两对情侣可以认为是一个联通块。已知郭铮鹏每个联通块每个联通块地去烧情侣(给联通块泼汽油方便些嘛),并且当一个联通块的点数为P的时候,郭铮鹏需要P^2桶汽油。

注意爆栈的情况,用bfs,赛场有人用并查集我也是资磁的((‵□′))

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define INF (2139062143)
#define fi first
#define se second
typedef long long ll;
int n,m,t;
int a[4000][4000],b[4000][4000];
queue<pi > q;
void dfs(int X,int Y){
    q.push(mp(X,Y));
    b[X][Y]=1;
    while(!q.empty()) {
        int x=q.front().fi,y=q.front().se;
        q.pop();
        ++t;
        if (a[x-1][y]&&!b[x-1][y]) q.push(mp(x-1,y)),b[x-1][y]=1;
        if (a[x+1][y]&&!b[x+1][y]) q.push(mp(x+1,y)),b[x+1][y]=1;
        if (a[x][y-1]&&!b[x][y-1]) q.push(mp(x,y-1)),b[x][y-1]=1;
        if (a[x][y+1]&&!b[x][y+1]) q.push(mp(x,y+1)),b[x][y+1]=1;
    }
}
int main(){
//  freopen("c.in.cpp","r",stdin);
    cin>>n>>m;
    MEM(b) MEM(a)
    ll ans=0;
    For(i,n) For(j,m) scanf("%d",&a[i][j]);
    For(i,n) For(j,m) if (a[i][j]&&!b[i][j]) {
        t=0;
        dfs(i,j);
        ans+=(ll)t*t;
    //  cout<<t<<endl;
    }
    cout<<ans<<endl;

    return 0;
}

D. 郭铮鹏与线性代数

Description

郭铮鹏正在学习线性代数。有一天,他碰到了这样一道题目,给定平面上4 个不同的点,问

这四个点里取点所连成的直线中是否存在两条直线垂直?由于郭铮鹏已经快把高中数学忘

光了,他不得不求助于你。

Input

输入第一行为一个整数n, 1≤n≤20000

后面n 行,每行包含八个数x1,y1,x2,y2,x3,y3,x4,y4,分别表示四个点的坐标,保证这些数的绝

对值小于10000

Output

输出n 行,对于每一组输入数据,输出”Yes”表示存在,”No”表示不存在。

Sample Input

2

0 0 1 0 0 2 1 2

0 0 1 1 2 2 3 3

Sample Output

Yes

No

出数据的人用了小数QAQ

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
double x[4],y[4];
int check() {
    Rep(i,4) Fork(j,i+1,3) Rep(k,4) Fork(l,k+1,3)
        if (fabs(((x[i]-x[j])*(x[k]-x[l])+(y[i]-y[j])*(y[k]-y[l])))<1e-9) return 1;
    return 0;
}
int main(){
//  freopen("d.in.cpp","r",stdin);

    int n;
    cin>>n;
    while(n--) {
        Rep(i,4) scanf("%lf%lf",&x[i],&y[i]);
        if (check()) puts("Yes"); else puts("No");
    }

    return 0;
}

E. 郭铮鹏与老司机

郭铮鹏听说有一种叫老司机的人非常厉害,于是他现在放弃计算机科学做起了老司机。

有一天有N 个人要郭铮鹏这个老司机带带他/她,郭铮鹏的车最终只能再装入体重和不超过M 的人们。现在已知每个人的体重,问在体重和不超过M的情况下,郭铮鹏能最多带的体重和。

输入:

一共两行

第一个行两个数 N, M(0

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)

#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define INF (2139062143)
#define fi first
#define se second
typedef long long ll;
int n,m,t;
int f[2000];
int main(){
//  freopen("e.in.cpp","r",stdin);
    cin>>n>>m;
    MEM(f) f[0]=1;
    For(j,n) {
        int w;cin>>w;
        ForkD(i,w,m) {
            f[i]|=f[i-w];
        }
    }
    int ans=m;
    while(!f[ans]) --ans;
    printf("%d\n",ans);

    return 0;
}

F. GZP and Public Display of Affection

As having being alone for more than ten thousand years, he is likely to be hurt when some couples showing their love to each other in public occasions.

It is known that, if a couple which had shown their love to GZP has been proved to be brothers and sisters, the degree of hurt of GZP will decrease; and if GZP is hurt by a couple for more than one time, some degrees of hurt will increase.

GZP want to know the sum of hurt degrees in some periods of time.

There are two number in first line, N and M.

In the next line there are N numbers, which are the degrees of hurt.

There are M lines following, and for each line, there are two kinds of operations. The first is to ask the sum of hurt from the i-th day to the j-th (include i and j). The second is to change the hurt degree to X in some particular day.

The first line : N,M (1 <= N,M <= 100000)

The second line : ai (abs(ai) <= 1000)

The following M lines:

For each line : opt,l,r;

if Opt == 1, output the sum of [l,r]

if Opt == 2, change the L-th number to R

Sample Input:

5 3

1 2 3 4 5

1 2 4

2 3 2

1 2 4

Sample Output:

9

8

树状数组单点修改,区间求和。

有人暴力卡常过,如果这样的话记得sum[l,r]=tot-sum[1,l-1]-sum[r+1,n]

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)

#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define INF (2139062143)
#define fi first
#define se second
#define MAXN (100000*4)
typedef long long ll;
int n,m,t;
double b[MAXN]={0};
int lowbit(int x){return x&(-x);}
int add(int x,double v) {
    for(int i=x;i<=n;i+=lowbit(i)) b[i]+=v;
}
double qur(int x) {
    double ans=0;
    for(int i=x;i;i-=lowbit(i)) ans+=b[i];
    return ans;
}
int main(){
//  freopen("f.in.cpp","r",stdin);
    while(scanf("%d%d",&n,&m)!=EOF) {
        For(i,n) b[i]=0;
        For(i,n) {
            double p;
            scanf("%lf",&p);
            add(i,p);
        }
        For(i,m) {
            int p,l;
            scanf("%d%d",&p,&l);
            if (p==1) {
                int r;
                scanf("%d",&r);
                printf("%.0lf\n",qur(r)-qur(l-1));
            } else {
                double r;
                scanf("%lf",&r);
                double t=qur(l)-qur(l-1);
                add(l,r-t);
            }
        }
    }

    return 0;
}

G. GZP, Bureaucracy and Girlfriend

GZP is a student in Na’ix College of Ompxtqx Ctxenongly , which is one of the third batch of

undergraduate. One day, GZP wants to set up a student organization in order to know more girls,

as he thinks that it may increase the possibility of finding his girlfriend.

Then he want to know some regulations about setting up the organization. He searched all the

pages of the college website. It is interesting that he can not find any information about it, or it just

returns a “404 Not Found” by Windows IIS.

Then he cut several classes to find somebody to tell how he should do. Fortunately, he finally find

the person named NjcpuRAcb, who is in charge of student organizations with sacrifice of failing

many courses as there is a rule that every student should not cut more than three classes of one

course except for dead students. But NjcpuRAcb told he that he should get to LwocHiobKsw,

XwocKiQvi and QowKiQvi to get permissions in advance. So GZP has to get to LwocHiobKsw,

XwocKiQvi and QowKiQvi to ask for permissions. Unfortunately, each of three asks for some

permissions in advance from other people as well.

GZP wonders whether he could increase the poor possibility.

Obviously, if there exists a circle in the permission chain, GZP will be forever alone.

Input:

There are several test cases in this Problem. Each of them begins with a integer N (N <= 1000). Then

N lines follow, each line begins with a name, which require permissions from the left names of the

same line. (Some teachers may be kind enough that he/she does not require any other

permissions.)

It is guaranteed that there will be no same names in one line and no lines begin with same name

in one test case.

Names in a line are seprated by spaces, and it is guaranteed that there are only english characters

in names.

Output:

If GZP can set up the organization, just output “Wish you could see the first snow with your love

this year.” in a line; if he can not, just output “Forever Single Dog!” in a line.

Sample Input:

6

NjcpuRAcb LwocHiobKsw XwocKiQvi QowKiQvi

LwocHiobKsw EwiMwZs

XwocKiQvi EwiMwZs NvocUiobuMobu

QowKiQvi NvocUiobuMobu

NvocUiobuMobu EwiMwZs

EwiMwZs NjcpuRAcb

2

Hobo Eddie

Eddie

Sample Output:

Forever Single Dog!

Wish you could see the first snow with your love this year.

0 AC.

虽然是拓扑排序,但是TLE到不要不要的

数据里基本提到过没出现的所有情况(比如很长的字符串,完全图,还有空行,还有还没读到最后一行就EOF的。。)

,考验hash和卡常的时候到了

#include<bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=1;i<=n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define MEM(a) memset(a,0,sizeof(a));
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define INF (2139062143)
#define fi first
#define se second
#define MAXN (100000)
typedef long long ll;
typedef unsigned long long ull;
int n;
char s[10000000];
int id=0;
ull calc(bool &b,bool &b2) { //b 是否回车 b2 是否读入字符串
    char c;
    while((c=getchar())==‘ ‘);
    if (c==‘\n‘) {b=1;b2=0;return 0; }
    b2=1;
    ull t=c;
    while(1) {
        c=getchar();
        if (c==‘ ‘||c==‘\n‘) break;
        t=t*10000007+c;
    }
    b=c==‘\n‘;
    return t;
}
map<ull,int> h;
map<ull,int>::iterator it;
map<ull,string> h2;

int get(ull t) {
    while(1) {
        it=h.find(t);
        if (it==h.end())  {
            h[t]=++id;
            return id;
        }
        else {
            return it->se;
        }
    }
}
vector<int> edge[MAXN];
int deg[MAXN];
queue<int> q;
bool topsort() {
    int n=id,t=0;
    For(i,n) if (!deg[i]) q.push(i);
    while(!q.empty()) {
        int x=q.front(); q.pop();
        int sz=edge[x].size();
        Rep(i,sz) {
            int v=edge[x][i];
            deg[v]--;
            if (!deg[v]) q.push(v);
        }
        t++;
    }
    if (t==n) return 1;
    return 0;
}
char p[10000000];
string p2;
int main(){
//  freopen("7621/3.in","r",stdin);
//  freopen("G.out","w",stdout);

    while(scanf("%d",&n)!=EOF) {
        while(getchar()!=‘\n‘);
        MEM(deg) h.clear(); h2.clear(); id=0;
        For(i,n) {
            bool b,b2;
            calc(b,b2);
            int len=strlen(s);

            int lenp,nowi=0;
            {
                lenp=0;
                while(nowi<len&&s[nowi]==‘ ‘) nowi++;
                while(nowi<len&&s[nowi]!=‘ ‘) p[lenp++]=s[nowi],nowi++;
                p[lenp]=0;
            }
            int u=get(p,lenp);
            while(nowi<len) {
                {
                    lenp=0;
                    while(nowi<len&&s[nowi]==‘ ‘) nowi++;
                    while(nowi<len&&s[nowi]!=‘ ‘) p[lenp++]=s[nowi],nowi++;
                    p[lenp]=0;
                }
                if (!lenp) continue;
                int v=get(p,lenp);
                edge[u].pb(v);
                deg[v]++;
            }
        }
        if (topsort()) puts("Wish you could see the first snow with your love this year.");
        else puts("Forever Single Dog!");   

        For(i,id) edge[i].clear();
    }
    return 0;
}

H. GZP and Dating

Description

GZP wants to find a good girlfriend as soon as possible. After setting up a student union with a lot of girls, GZP invites several girls to dinner every night. GZP has a budget about the amount of money to pay every night, on the i-th day, he will spend R[i] yuan, M days in total. GZP has no money with him but N bank cards and the i-th has L[i] yuan. There’s a rule in the restaurant: GZP has to pay the money of a meal with only one bank card. Here comes the problem: how many meals GZP can afford at most? Let’s assume GZP will not spend any money except for girls.

Input

A integer N and M on the first line, 1 ≤ N ≤ 50

The next N lines contains L[i] respectively, 1 ≤ Li ≤ 10^9

The next line is M, 1 ≤ M ≤ 1023

The next M lines contains R[i] respectively, 1 ≤ Ri ≤ 128

Output

One integer, the number of meals GZP can afford

Sample Input

4

30

40

50

25

10

15

16

17

18

19

20

21

25

24

30

Sample Output

7

Hint

50–>15+16+19 or 15+16+17 or 15+17+18

40–>19+21

25–>25

30–>30

原题USACO fence8

http://www.nocow.cn/index.php/Translate:USACO/fence8

广度多维背包问题:虽然正解是暴搜+剪枝

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
#define MAXN (50+10)
#define MAXM (2000+10)
int n,m,mi;
ll L[MAXN],S=0,Sr[MAXM],r[MAXM];
int dfs(int x,int pos,ll spa) {  // now deal with item_x
    if (!x) return 1;
    if (S-Sr[mi]<spa) return 0;
    Fork(i,pos,n) {
        if (L[i]>=r[x]) {
            L[i]-=r[x];
            if (L[i]<r[1]) spa+=L[i];
            bool fl=dfs(x-1, (r[x]==r[x-1] )? i: 1 , spa);
            if (L[i]<r[1]) spa-=L[i];
            L[i]+=r[x];
            if (fl) return 1;
        }
    }
    return 0;
}
int main()
{
//  freopen("H.in","r",stdin);
 // freopen(".out","w",stdout);

    n=read();
    For(i,n) cin>>L[i],S+=L[i]; //bag
    m=read();
    For(i,m) cin>>r[i]; //item
    sort(L+1,L+1+n,greater<ll>());
    r[0]=0;
    sort(r+1,r+1+m);
    Sr[0]=0;
    For(i,m) Sr[i]=Sr[i-1] + r[i];

    while(Sr[m]>S) --m;
    while(r[m]>L[1]) --m;

    int le=0,ri=m,ans=0;
    while(le<=ri) {
        mi=le+ri>>1; // now r_i from 1..m
        if (dfs(mi,1,0)) ans=mi,le=mi+1;
        else ri=mi-1;
    }
    cout<<ans<<endl;
    return 0;
}
时间: 2024-08-30 08:05:03

xjtu暑期集训2016-7-9 题解的相关文章

2016暑期集训集中贴

暑假期间网上练习的题解将在此博客公布,具体内容见后文. 题目链接:  点我 以下是暑期集训各队员题量统计(包括赛后补的题) 2016暑期集训AcBoard(截至07-23) 总题量 5 5 7 5   10 10 10 11    63 队员名称 cf-1 cf-2 cf-3 cf-4 cf-5 模拟训练1 模拟训练2 模拟训练3 模拟训练4 模拟训练5 题量小计 cb 2 2 3 3   6 6 6 4   32 fdf 4 3 3 2   5 7 2 4   30  ctr 3 3 3 3

题解报告(CDUT暑期集训——第三场)

题解报告(CDUT暑期集训--第三场) A - Problem A. Ascending Rating HDU - 6319 思路:单调队列板子题?(但是弱的一批的我还是不会用(有空补上 用的滑动窗口算法 按着题解的从后往前做(ps:菜是原罪 AC代码 #include<stdio.h> #include<iostream> #include<math.h> #include<algorithm> #include<string.h> #incl

【UOJ274】【清华集训2016】温暖会指引我们前行 LCT

[UOJ274][清华集训2016]温暖会指引我们前行 任务描述 虽然小R住的宿舍楼早已来了暖气,但是由于某些原因,宿舍楼中的某些窗户仍然开着(例如厕所的窗户),这就使得宿舍楼中有一些路上的温度还是很低. 小R的宿舍楼中有n个地点和一些路,一条路连接了两个地点,小R可以通过这条路从其中任意一个地点到达另外一个地点.但在刚开始,小R还不熟悉宿舍楼中的任何一条路,所以他会慢慢地发现这些路,他在发现一条路时还会知道这条路的温度和长度.每条路的温度都是互不相同的. 小R需要在宿舍楼中活动,每次他都需要从

bzoj 4736 /uoj274【清华集训2016】温暖会指引我们前行 lct

[清华集训2016]温暖会指引我们前行 统计 描述 提交 自定义测试 寒冬又一次肆虐了北国大地 无情的北风穿透了人们御寒的衣物 可怜虫们在冬夜中发出无助的哀嚎 “冻死宝宝了!” 这时 远处的天边出现了一位火焰之神 “我将赐予你们温暖和希望!” 只见他的身体中喷射出火焰之力 通过坚固的钢铁,传遍了千家万户 这时,只听见人们欢呼 “暖气来啦!” 任务描述 虽然小R住的宿舍楼早已来了暖气,但是由于某些原因,宿舍楼中的某些窗户仍然开着(例如厕所的窗户),这就使得宿舍楼中有一些路上的温度还是很低. 小R的

SDU暑期集训排位(2)

A. Art solved by sdcgvhgj 3min 签到 B. Biology solved by sdcgvhgj 85min 暴力 C - Computer Science solved by rdc 16min 题意 数轴上有一些点,求极短长度 x,使得存在 \(n\) 个区间,第 \(i\) 个区间包含 \(a_i\),包含的点数至少 \(k\) 个. 做法 每个区间相互独立. 对点排序. 用 \(x_{i+k-1} - x_i + 1\) 区间更新 \([x_i,x_{i+k

2014年CCNU-ACM暑期集训总结

2014年CCNU-ACM暑期集训总结 那个本期待已久的暑期集训竟然就这样的,溜走了.让自己有点措手不及,更多的是对自己的疑问,自己能否在ACM这个领域有所成就.带着这个疑问,先对这个暑假做个总结吧. 第一周来的时候,状态还没有融入进去,学长们也不在,就直接布置了一套题目,考察的是贪心策略.学习的时候很有激情,毕竟是期待了那么久的场景,所以大家都很认真,希望自己能够有所进步. 第二周,搜索专题.主要学习宽度优先搜索(BFS)与深度优先搜索(DFS),刚开始学比较吃力,因为自己对这方面的领悟有点迟

第二第三周暑期集训总结

##第二第三周暑期集训总结在第二第三周中,我主要看了状压DP,数位DP,树状DP的主要内容.同时,在做训练赛的过程中,发现一些知识点掌握的不好,于是又回头复习了一下,包括图的一些基本概念,最短路算法,并查集,最小生成树,图的存储方法(矩阵,邻接表(数组)).还有很关键的一件事就是参加了今年的CCPC网络选拔赛.####状压DP刚开始看的时候,我觉得状压DP很难.在恶补了位运算的知识后,我又自己敲了一遍代码,突然有一种茅塞顿开的感觉.这是我对状压DP的理解:状压DP其实也没什么深奥的,就是利用位运

2015年CCNU-ACM暑期集训总结

2015年CCNU-ACM暑期集训总结 本来很早就该做个总结的,可是一直拖到今天,也就是回学校的前一天晚上才下笔,拖延症越来越严重了.为了写这篇总结,我还特意去看了下去年的,映入眼帘的是一道流水账.=_= 往事不堪回首,还是简要说说2015年暑期集训的感想吧. 又是一年暑期集训,大三狗了,还有不到两年学生生涯,想想还蛮伤感的.额,扯远了扯远了.对今年暑期集训呢,其实说实话也没什么感想,唯一的感想就是越来越发现自己弱得一逼.首先说一下多校.多校就是一个让自己受虐的地方,不是那谁说的,要在受虐中成长

SDU暑期集训排位(6)题解

L - Olympiad Training $FWT$.首先,观察到$n$很小,我们可以想办法求出每个子集的答案,但是$m$很大,直接枚举子集的方法肯定行不通.不妨考虑对每个$topic$单独考虑贡献,设当前考虑的是第$j$个$topic$,然后枚举最大值,设$a_{ij}$为最大值,其他的人我们只能选比它小的,设我们能选出的最大的集合为$mask$,显然,对于$mask$子集$s$,如果$s$包含第$i$个人,答案就需要加上$a_{ij}$,如果不包含,它的最大值就为其他值,我们不妨分两步完成