A. Towerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.
InputThe first line contains an integer N (1?≤?N?≤?1000) — the number of bars at Vasya’s disposal. The second line contains N space-separated integers li — the lengths of the bars. All the lengths are natural numbers not exceeding 1000.
OutputIn one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.
/* ***********************************************Sample test(s)input3
1 2 3output1 3input4
6 5 6 7output2 3
Author :
Created Time :2015/6/15 2:27:51
File Name :7.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 1<<30
#define maxn 10000+10
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
int a[maxn];
int n;
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
while(cin>>n){
int x;
cle(a);
for(int i=1;i<=n;i++){
cin>>x;
a[x]++;
}
int ans=0;
int Max=-INF;
for(int i=1;i<=1000;i++){
if(a[i]!=0)ans++;
Max=max(a[i],Max);
}
cout<<Max<<" "<<ans<<endl;
}
return 0;
}
A. Towers
最新推荐文章于 2021-10-12 08:57:41 发布