hdoj5246 Super Isaiah acmer_hdoj5246 Super Acmer

Source: Internet
Author: User

Super Isaiah Acmer time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 2153 accepted Submission (s): 585


Problem Description hundred degrees is a acmer, is also a super Isaiah, each acmer have a fighting capacity, including hundred degrees. The definition of the so-called Super Isaiah, & #8232, is that if the confrontation is just close to the limit state, it will stimulate morale and enhance the strength.

Specifically, it is the hundred degree now to accept some acmer challenges, these acmer have n individuals, the first person's combat effectiveness is a[i].

& #8232; hundred degrees next can autonomously arrange with this n acmer PK order, he wants to win in the PK race another acmer, must make their combat effectiveness is not less than the other side (draw the situation he will according to the rules of the Hundred Decimal Dictionary on the first line).

If the hundred degree of combat power is greater than the other side, then the hundred degrees will easily win, not to exercise and proud, his future combat will remain in this value, will never change. & #8232; If hundred degrees of fighting equals each other, so the hundred degrees in the win at the same time will also feel very hard, but this will inspire the hundred small degree of morale, make him work hard to brush the problem, in the next PK game, the battle capacity up to raise K point (that can raise 0~k point arbitrary value).

K is the upper limit of the potential of the hundred degree, will be given an initial value, this potential increase in the upper limit K in the subsequent game will fall.

With every beat of a acmer, this potential limit of k will be reduced by 1 (because the super sub will also feel tired), but K will only be reduced to 0, that is, there will be no fighting loss. That is, the first game if you inspire a small degree of fighting, he can improve the combat effectiveness of any of the 0~k, if the second race continues to be motivated, he can be on the basis of the first promotion, the combat effectiveness of 0 ~ max (0,k−1), and so on.

M is a small degree of initial combat capacity, that is, for the first time in the PK game, you can choose any value of 0~m as his combat effectiveness.

Now I would like you to write a program to determine whether the hundred degrees win over all the Acmer.
Input input contains multiple sets of data (no more than 500 groups of data)

The first line, an integer t, represents the T-group data

For each set of data, the first row consists of three integers n,m,k (1≤n≤104,1≤m,k≤108)

The second line consists of n positive integers, representing the combat effectiveness of the burly man (a positive integer of no more than 1012).
Output for each set of data, first out a row of case #i: (1≤i≤t)

If the hundred can beat all the Acmer, and then output "Why am I so diao?"

Otherwise, "madan!" will be exported.
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 Diao? Case #2: madan! Hint The first group of examples to explain the 5 Acmer, the initial combat selection range is [0,11], and then the upper limit of each battle effectiveness is 3,2,1,0,0,..., 0 of the first to make their initial combat capacity of 10, defeating the combat effectiveness of 10 of the first Acmer, Then choose the combat effectiveness of 3, become 13, beat the battle effectiveness of the second Acmer 13, and then choose the combat effectiveness of 2, become 15, defeating the combat effectiveness of the third Acmer, and then in any order to defeat the remaining Acmer

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <list>
#include <queue>
#include <vector>
using namespace std;
const int maxn=10010;
Long long NUM[MAXN]; 
int main ()
{
	int t,test=1;
	Long long i,j,n,m,k;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%lld%lld%lld", &n,&m,&k);
		for (i=0;i<n;++i) {
			scanf ("%lld", &num[i]);
		}
		Sort (num,num+n);
		printf ("Case #%d:\n", test++);
		Long long cnt=m,maxm=num[n-1],pos=-1;
		for (i=0;i<n;++i) {
			int temp=upper_bound (num,num+n,cnt)-num-1;
			if (temp<=pos) break;
			cnt=num[temp]+k;k--;p os=temp;
			if (k<=0) break;
		if (CNT>=MAXM) {
			printf ("Why am I so diao?\n");
		}
		else {
			printf ("madan!\n");
		}
	}
	return 0;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.