2015 百度之星 1001 超级赛亚ACMer 贪心
超级赛亚ACMer
Time Limit: 20 Sec Memory Limit: 256 MB
题目连接
http://acdream.info/problem?pid=1750
Description
Input
Output
Sample Input
2 5 11 3 15 13 10 9 8 5 11 3 8 9 10 13 16
Sample Output
Case #1: why am I so diao? Case #2: madan!
HINT
第一组样例解释 5个ACMer,初始战斗力选择范围是[0,11],接下来每场战斗力提升上限是3,2,1,0,0,...,0 百小度首先使得自己的初始战斗力为10,打败战斗力为10的第一个ACMer, 然后选择战斗力提升3,变成13,打败战斗力为13的第二个ACMer, 然后选择战斗力提升2,变成15,打败战斗力为15的第三个ACMer, 之后再以任意顺序打败剩下的ACMer
题意
题解:
傻逼题
代码:
//qscqesze #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; //freopen("D.in","r",stdin); //freopen("D.out","w",stdout); #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) #define test freopen("test.txt","r",stdin) #define maxn 2000001 #define mod 10007 #define eps 1e-9 int Num; char CH[20]; const int inf=0x3f3f3f3f; const ll infll = 0x3f3f3f3f3f3f3f3fLL; inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } inline void P(int x) { Num=0;if(!x){putchar('0');puts("");return;} while(x>0)CH[++Num]=x%10,x/=10; while(Num)putchar(CH[Num--]+48); puts(""); } //************************************************************************************** int n, m, k; ll a[maxn]; bool solve() { sort(a, a + n); int p = upper_bound(a, a + n, m) - a; if (!p) return false; --p; ll now = a[p]; for (int i = p + 1; i < n; ++i) { if (a[i] > now + k) return false; now = a[i]; if (k) --k; } return true; } int main() { int T, cas = 0; scanf("%d", &T); while (T--) { scanf("%d%d%d", &n, &m, &k); for(int i=0;i<n;i++) a[i]=read(); printf("Case #%d:\n", ++cas); puts(solve()? "why am I so diao?": "madan!"); } return 0; }