Bzoj1939 [Croatian2010] Zuma】的更多相关文章

Time Limit: 4 Sec  Memory Limit: 64 MBSubmit: 43  Solved: 31 Description 有一行 N 个弹子,每一个都有一个颜色.每次可以让超过 K 个的连续的同颜色的一段 弹子消失,剩下的会重新紧凑在一起.你有无限的所有颜色的弹子,要求在这行弹子中插入 最少的弹子,使得弹子全部消失. Input The first line of input contains two integers N (1 ≤ N ≤ 100) and K (2 ≤…
隐约记得类似的一道JSOI祖玛……然后好像这题不能够把珠子合并成一段?或许是因为这里珠子碰在一起之后可以不消除? Description 有一行 N 个弹子,每一个都有一个颜色.每次可以让超过 K 个的连续的同颜色的一段 弹子消失,剩下的会重新紧凑在一起.你有无限的所有颜色的弹子,要求在这行弹子中插入 最少的弹子,使得弹子全部消失. Input The first line of input contains two integers N (1 ≤ N ≤ 100) and K (2 ≤ K ≤…
题目: BZOJ1939(权限题) 分析: 这题很容易看出是DP,但是状态和转移都不是很好想-- 用\(dp[l][r][c]\)表示在\(l\)前面已经新加了\(c\)个和\(l\)一样的弹子时,使区间\([l,r]\)消完所需插入的弹子数量 显然,当\(c\geq k-1\)时,这\(c\)个弹子和\(l\)组成了连续的至少\(k\)个弹子,这些情况是类似的(都可以一次消完).因此可以用\(c=k-1\)的状态代表所有\(c\geq k-1\)的状态. 对于状态\((l,r,k-1)\),\…
题目链接 [洛谷传送门] 题解 \(f[i][j][k]\)表示在消除了\((i,j)\),在后面加上了\(k\)个珠子的总的珠子数. 考虑三种决策:(题目给出的\(k\)在下文表示成\(K\)) 决策1 当\(k<K-1\)时,可以考虑在加一个珠子,也就是状态\(f[i][j][k+1]\)转移得到\(f[i][j][k]\).因为加上了一个珠子,那么就方程为\(f[i][j][k]=min(f[i][j][k+1]+1)\) 决策2 如果\(k=K+1\),说明这个可以消除,也就是从\(f[…
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem 10983 18765 Y 1036 [ZJOI2008]树的统计Count 5293 13132 Y 1588 [HNOI2002]营业额统计 5056 13607 1001 [BeiJing2006]狼抓兔子 4526 18386 Y 2002 [Hnoi2010]Bounce 弹飞绵羊 43…
1032: [JSOI2007]祖码Zuma Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 672  Solved: 335[Submit][Status][Discuss] Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏——这就是著名的祖玛游戏.祖玛游戏的主角是一只石青蛙,石青蛙会吐出各种颜色的珠子,珠子造型美丽,并且有着神秘的色彩,环绕着石…
D. Zuma time limit per test:  2 seconds memory limit per test:  512 megabytes input:  standard input output:  standard output Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color…
D. Zuma   Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible. In one second, Genos i…
D. Zuma 题目连接: http://www.codeforces.com/contest/608/problem/D Description Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gems…
Codeforces Round #336 (Div. 2) D. Zuma 题意:输入一个字符串:每次消去一个回文串,问最少消去的次数为多少? 思路:一般对于可以从中间操作的,一般看成是从头开始(因为只需要考虑一边),当考虑最左边的数时,有多少中消去方法?每种消去方法对结果的贡献又是多少?同时结果的区间又是怎么变化?这就是dp式子: 1.当单独消去这个元素时,dp[l][r] = 1 + dp[l+1][r]; 2.当存在一个k,l< k <= r,使得c[l] == c[k]时,可以认为在…
1032: [JSOI2007]祖码Zuma Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 637  Solved: 318[Submit][Status][Discuss] Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏——这就是著名的祖玛游戏.祖玛游戏的主角是一只石青蛙,石青蛙会吐出各种颜色的珠子,珠子造型美丽,并且有着神秘的色彩,环绕着石…
题目 题目 Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (includ…
Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including th…
Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including th…
http://www.lydsy.com/JudgeOnline/problem.php?id=1032 https://www.luogu.org/discuss/show?postid=8416 #include<cstdio> #include<cstring> #include<iostream> using namespace std; #define N 501 int a[N]; int col[N],num[N]; int f[N][N]; void r…
1032: [JSOI2007]祖码Zuma Time Limit: 10 Sec  Memory Limit: 162 MB Submit: 1105  Solved: 576 [Submit][Status][Discuss] Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏——这就是著名的祖玛游戏.祖玛游戏的主角是一只石青蛙,石青蛙会吐出各种颜色的珠子,珠子造型美丽,并且有着神秘的色彩,环…
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible. In one second, Genos is able to…
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible. In one second, Genos is able to…
Description Let's play the game Zuma! There are a sequence of beads on a track at the right beginning. All the beads are colored but no three adjacent ones are allowed to be with a same color. You can then insert beads one by one into the sequence. O…
time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the…
Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible. In one second, Genos is able to…
Zuma 这个题没有素质!它卡常! 我发现网上很多人的题解都写得很奇怪,也不好确定正确性,所以我借这篇题解表达一下愚见 定义$ dp[i][j][0...4]$表示 0:消完了 1:还剩1个0 2:还剩2个0 3:还剩1个1 4:还剩2个1 转移极其繁琐 卡常技巧:相邻相同的可以压成一个块 const int N=410; #define chk(a,b) (a>b&&(a=b)) //卡常 int n,m; char s[N]; int a[N],b[N],c[N],dp[N][N…
以下是从中文翻译成人话的题面: 给定一个长度小于等于500的序列,每个数字代表一个颜色,每次可以消掉一个回文串,问最多消几次可以消完? (7.16) 这个题从洛谷pend回来以后显示有103个测试点(满屏的AC好爽-- 上午考试的时候这个题直接用马拉车暴力贪心骗了十五分.然而每次消掉一个最长的回文串并不一定是最优的策略,这道题要用DP来做. 设计状态f[l, r]表示消掉原串这段区间内串的最小代价.老师说直接递推不好搞,应该是因为这个循环的阶段不好确定.考虑用记忆化搜索来转移. 四种情况: 1.…
Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand. Each time, you may choose a ball in your hand, and insert it into the row (including th…
链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1032 Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏--这就是著名的祖玛游戏.祖玛游戏的主角是一只石青蛙,石青蛙会吐出各种颜色的珠子,珠子造型美丽,并且有着神秘的色彩,环绕着石青蛙的是载着珠子的轨道,各种颜色的珠子会沿着轨道往前滑动,石青蛙必需遏止珠子们滚进去轨道终点的洞里头,如何减少珠子…
题目大概说,有n个颜色的宝石,可以消除是回文串的连续颜色序列,问最少要几下才能全部消除. 自然想到dp[i][j]表示序列i...j全部消除的最少操作数 有几种消除的方式都能通过枚举k(i<=k<j)从min(dp[i][k],dp[k+1][j])转移 还有一种先消除中间的,剩余两部分组成回文串再消除,这种消除方式转移不会..想到的时间复杂度太高.. 看了tourist的代码,发现神的转移好简洁,这种方式就是从dp[i+1][j-1](c[i]=c[j])转移的 应该可以这么理解,如果c[i…
描述 祖玛是一款曾经风靡全球的游戏,其玩法是:在一条轨道上初始排列着若干个彩色珠子,其中任意三个相邻的珠子不会完全同色.此后,你可以发射珠子到轨 道上并加入原有序列中.一旦有三个或更多同色的珠子变成相邻,它们就会立即消失.这类消除现象可能会连锁式发生,其间你将暂时不能发射珠子. 开发商最近准备为玩家写一个游戏过程的回放工具.他们已经在游戏内完成了过程记录的功能,而回放功能的实现则委托你来完成. 游戏过程的记录中,首先是轨道上初始的珠子序列,然后是玩家接下来所做的一系列操作.你的任务是,在各次操作…
题目链接 给一个长度为n的序列, 每一次可以消去其中的一个回文串, 问最少几次才可以消完. 代码很清楚 #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <map> #include <set> #include <…
题目大意:给定一个祖玛序列,任选颜色射♂出珠子,问最少射♂出多少珠子 输入法近期越来越奇怪了0.0 首先我们把连续同样的珠子都缩在一起 令f[i][j]表示从i開始的j个珠子的最小消除次数 初值 f[i][1]=cnt[i]==1?2:1 然后对于每一个区间.我们枚举中间点,拆成两半求和 假设这个区间两端点颜色同样.我们还能够把中间消掉,然后两边再补射1或0个 尼玛珠子的颜色能够是0--由于这个WA了半天 真~!@#$%^&*() 此外此题是有BUG的 我的代码不能考虑将三个离散的珠子 聚在一起…
题目描述 这是一个流行在Jsoi的游戏,名称为祖玛. 精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏——这就是著名的祖玛游戏.祖玛游戏的主角是一只石青蛙,石青蛙会吐出各种颜色的珠子,珠子造型美丽,并且有着神秘的色彩,环绕着石青蛙的是载着珠子的轨道,各种颜色的珠子会沿着轨道往前滑动,石青蛙必需遏止珠子们滚进去轨道终点的洞里头,如何减少珠子呢?就得要靠石青蛙吐出的珠子与轨道上的珠子相结合,颜色相同者即可以消失得分!直到轨道上的珠子通通都被清干净为止. 或许你并不…