P3507 [POI2010]GRA-The Minima Game】的更多相关文章

P3507 [POI2010]GRA-The Minima Game 题目描述 Alice and Bob learned the minima game, which they like very much, recently. The rules of the game are as follows. A certain number of cards lies on a table, each inscribed with a positive integer. The players m…
题目描述 Alice and Bob learned the minima game, which they like very much, recently. The rules of the game are as follows. A certain number of cards lies on a table, each inscribed with a positive integer. The players make alternate moves, Alice making t…
题目描述 Alice and Bob learned the minima game, which they like very much, recently. The rules of the game are as follows. A certain number of cards lies on a table, each inscribed with a positive integer. The players make alternate moves, Alice making t…
直接dp就好了 每个人肯定会去选最大的,用dp[i]表示选了后i个点时先手-后手的最大值(因为从后往前扫才好转移啊 QwQ~) dp[i]=max(c[j]-dp[j-1]),(j<=i) 直接维护max值就好了~ #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace std; ; int n,c[Mx]; long long…
题目大意: 给定\(n\)个正整数,\(a, b\)两个人轮流取,\(a\)先手 每次可以取任意多的数,直到取完,每次的得分为取的数中的最小值 \(a, b\)都会使自己的得分减去对手的得分更大,询问最后\(a\)的得分减去\(b\)的得分的大小 先考虑排序 排完序之后,先手一定取连续的一段 如果不取完,那么后手有更多的选择空间(可以选择大数或者带着大数选前面的区间) 设\(f[i]\)表示\(1 \sim i\)中先手取比后手取多的最大值 那么有\(f[i] = max(-f[j] + a[j…
2091: [Poi2010]The Minima Game Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 243  Solved: 163[Submit][Status] Description 给出N个正整数,AB两个人轮流取数,A先取.每次可以取任意多个数,直到N个数都被取走.每次获得的得分为取的数中的最小值,A和B的策略都是尽可能使得自己的得分减去对手的得分更大.在这样的情况下,最终A的得分减去B的得分为多少. Input 第一行一个正整…
2091: [Poi2010]The Minima Game DP 链接 https://www.lydsy.com/JudgeOnline/problem.php?id=2091 思路 这类问题好迷呀. 我们先从小到大sort 先手一定是个后缀. 因为你不能留下大数让对手选呀. 然后后手就在你选择的i前面选([1,i-1])后手及其之后的操作. f[i]表示前i个里面先手的最大值 f[i]=min(f[i-1],a[i]-f[i-1]) 要不这个i点没有贡献,先手是f[i-1],要不就是选这个…
2091: [Poi2010]The Minima Game 链接 分析: 首先排序后,一定是选的连续的一段. f[i]表示前i个位置,先手-后手的最大得分. 那么考虑第i个位置是否选,如果选,先手选的就是从i开始到i的一段,后手在1到i-1就变成了先手,所以就是a[i]-f[i-1]. 否则第i个位置不选,直接从i-1转移即可. 代码: #include<cstdio> #include<algorithm> #include<iostream> #include&l…
The Minima Game bzoj-2091 Poi-2010 题目大意:给出N个正整数,AB两个人轮流取数,A先取.每次可以取任意多个数,直到N个数都被取走.每次获得的得分为取的数中的最小值,A和B的策略都是尽可能使得自己的得分减去对手的得分更大.在这样的情况下,最终A的得分减去B的得分为多少. 注释:$1\le n\le 10^6$. 想法:显然从大到小依次选. 之后暴力地dp,根本意义上是一种模拟贪心. Code: #include <iostream> #include <…
Description 每次可以任取数字,使用最优策略让差最大. Sol DP. 一开始我写了个单调队列贪心,然后狂WA不止... 正着做有后效性,因为前面的决策无法保证在后面是最优秀的,但如果倒这做就没有后效性了..感觉倒着做这种想法总是容易忽略,它对前面的影响应该多考虑一下. 然后DP就可以了...比较简单的DP.. Code /************************************************************** Problem: 2091 User:…