acm_icpc网络赛第五站:北京赛区

北京嘛,没什么好说的。。实验室貌似没出线的。。哎 就一道水题还被我英语给坑了。。

哈希一水:

Grade

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)

Total Submission(s): 344    Accepted Submission(s): 195

Problem Description

Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it’s grade s is

s = 10000 - (100 - w)^2

What’s more, Ted also has to report the mode of the grade of these mushrooms. The mode is the value that appears most often. Mode may not be unique. If not all the value are the same but the frequencies of them are the same, there is no mode.

Input

The first line of the input contains an integer T, denoting the number of testcases. Then T test cases follow.

The first line of each test cases contains one integers N (1<=N<=10^6),denoting the number of the mushroom.

The second line contains N integers, denoting the weight of each mushroom. The weight is greater than 0, and less than 200.

Output

For each test case, output 2 lines.

The first line contains "Case #x:", where x is the case number (starting from 1)

The second line contains the mode of the grade of the given mushrooms. If there exists multiple modes, output them in ascending order. If there exists no mode, output “Bad Mushroom”.

Sample Input

3
6
100 100 100 99 98 101
6
100 100 100 99 99 101
6
100 100 98 99 99 97

Sample Output

Case #1:
10000
Case #2:
Bad Mushroom
Case #3:
9999 10000
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
using namespace std;
int h[100010],ans[100010];
int main()
{
    int T,n,x,cas=1;
    scanf("%d",&T);
    while(T--)
    {
    	memset(h,0,sizeof(h));
    	scanf("%d",&n);
    	int MAX=0,p=0;
    	for(int i=0;i<n;i++)
		{
			scanf("%d",&x);
			int s=10000-(100-x)*(100-x);
			h[s]++;
			if(h[s]>MAX)
				MAX=h[s];
		}
		for(int i=0;i<10010;i++)
		{
			if(h[i]&&h[i]==MAX)
			{
				MAX=h[i];
				ans[p++]=i;
			}
		}
			printf("Case #%d:\n",cas++);
			if(p==1)
			{
				printf("%d\n",ans[0]);
				continue;
			}
			if(p*MAX==n)
			{
				printf("Bad Mushroom\n");
				continue;
			}
			sort(ans,ans+p);
			for(int i=0;i<p;i++)
				if(i!=p-1)
				printf("%d ",ans[i]);
			    else
				printf("%d\n",ans[i]);
    }
	return 0;
}
时间: 2024-12-28 05:08:46

acm_icpc网络赛第五站:北京赛区的相关文章

acm_icpc网络赛第六站:上海赛区(跪烂心已死)

最后一站了,很无奈的是还是没出线,最终3题结束,排名380 不得不承认自己不行,总觉着自己才弄了几个月,然后各种为自己的弱找借口,不行就是不行,没有借口,以后要更加努力了.废话不多说了 Fighting! 1006: Sawtooth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 466    Accepted Submission(

acm_icpc网络赛第三站:西安赛区

chp居然没来..然后我跟zmc鼓捣了一下午..出了3题 有一道貌似是DP水题..然后我俩都不会dp..A题水题不说了,E题博弈论模板..然后我俩也都不会博弈论..现场找的模板..F题无脑BFS..一开始看成计算几何了没敢做sad.. A题: Post Robot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 57    Accept

acm_icpc网络赛第二站:鞍山赛区

这次..啥也不说了 chp他两上课来晚了..我也没账号..开场半小时才开始做的,就敲了一道水题..然后他们两一直在商量那道计算几何..最后还是没出来. Osu! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 140    Accepted Submission(s): 93 Special Judge Problem Descript

acm_icpc网络赛第一站:牡丹江赛区

sad没想到自己菜成这个样子,虽然第一次打组队赛,本来也没指望出线什么的,结果3人鼓捣了半天除了两个水题,A题太水不说了,一般都是5分钟内解决,最快的好像是2分钟..神手速orz,a题是chp敲的1A,然后他就去做了c题,后来用记录路径的bfs搜了几次都TLE了,后来c题也不了了之了,然后看到J题过了一大片,果断枚举水过,wa了5次..在之后我敲了H题,TLE..sad 纯暴力算法果然不行..事后学长说是记忆化搜索?反正整个实验室都没出来H题好像.. A题: The Himalayas Time

网络工程师第五站-有线、无线同网段混合组网(多FAT案例)

本案例中用到的设备: 路由器:cisco 2851 交换机:cisco WS-C3750G-12S (HX),接入:WS-C2960-48TC-L AP : 华为AP3010dn-AGN 3750G 作为该网络核心交换机HX,前面的接口(下联接口)均access vlan 100,起vlan100 做网关,并配置DHCP服务,下联接入交换机:最后一个口设IP,与路由器互联,以默认路由方式路由到路由器.路由器做NAT,连上外网. 接入交换机均空配置运行,下联PC和AP.该网现有线网.无线网都在vl

hihocoder1236(北京网络赛J):scores 分块+bitset

北京网络赛的题- -.当时没思路,听大神们说是分块+bitset,想了一下发现确实可做,就试了一下,T了好多次终于过了 题意: 初始有n个人,每个人有五种能力值,现在有q个查询,每次查询给五个数代表查询的五种能力值,输出有多少个人每种能力值都比查询的小 n和q都是50000,每种能力值最大也为50000 思路: 对于某一个大小的能力值,有哪些人的此项能力值比他小可以用一个50000的bitset表示.这样我们在查询的时候就可以拿到5个对应的bitset,对其进行and就可以得出最终的人数 这样每

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛

Banana Bananas are the favoured food of monkeys. In the forest, there is a Banana Company that provides bananas from different places. The company has two lists. The first list records the types of bananas preferred by different monkeys, and the seco

08年acm区域赛北京赛区 部分题解题报告

08年区域赛北京赛区 http://poj.org/searchproblem?field=source&key=Beijing+2008 POJ 3921 Destroying the bus stations 题目还是比较难的,当时的榜似乎只有4/25的通过/提交,其实题目数据很水.学长转换模型写了网络流求最小割,可以AC,不过自己造了个数据推翻了正确性.我写了个很挫的bfs套bfs,外层是最小的删除点数,内层是求最短路,数据很水可以AC.但比较蛋疼的在于bfs耗内存,而且队列中的点数是阶乘

2015北京网络赛A题The Cats&#39; Feeding Spots

题意:给你一百个点,找个以这些点为中心的最小的圆,使得这个圆恰好包含了n个点,而且这个圆的边界上并没有点 解题思路:暴力枚举每个点,求出每个点到其他点的距离,取第n大的点,判断一下. 1 #include<cstdio> 2 #include<cmath> 3 #include<algorithm> 4 #include<iostream> 5 #include<memory.h> 6 using namespace std; 7 const i