(new ) war2 题解:总体数据而言,我们很容易想到着就是DP啊,我们DP数组,用状态压缩,代表有那些点已经被占领过了,代表上一次我占的是那个.对于每一次状态转移,若当前我们要占领的Portal在占领后有加分,那么就转移加分与基础值的和,否则只转移基础值.最后判断一下当代表的状态已经有占领个了,就记录下当前的最大值. var n,m,tot,cnt,ans,x,y,c:int64; i,j,k:longint; a:array[-100..100]of int64; f,b:array…
AC Challenge 30.04% 1000ms 128536K Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems. However, he can submit ii-th problem if and only if he has submitted (and passed, of cours…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3777 Time Limit: 2 Seconds Memory Limit: 65536 KB The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange the order…
看到20的数据量很容易想到状压dp. 开1<<20大小的数组来记录状态,枚举n个糖包,将其放入不同状态中(类似01背包思想) 时间复杂度O(n*(2^20)). import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static int[][] a = new int[105][25]; static int[] sta…
ACM-ICPC 2018 南京赛区网络预赛E: 题目链接https://www.jisuanke.com/contest/1555?view=challenges Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems. However, he can submit ii-th problem if and…