C. Boxes Packing
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Mishka has got n empty boxes. For every i (1 ≤ i ≤ n), i-th box is a cube with side length ai.

Mishka can put a box i into another box j if the following conditions are met:

  • i-th box is not put into another box;
  • j-th box doesn't contain any other boxes;
  • box i is smaller than box j (ai < aj).

Mishka can put boxes into each other an arbitrary number of times. He wants to minimize the number of visible boxes. A box is calledvisible iff it is not put into some another box.

Help Mishka to determine the minimum possible number of visible boxes!

Input

The first line contains one integer n (1 ≤ n ≤ 5000) — the number of boxes Mishka has got.

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109), where ai is the side length of i-th box.

Output

Print the minimum possible number of visible boxes.

Examples
input
3
1 2 3
output
1
input
4
4 2 4 3
output
2
Note

In the first example it is possible to put box 1 into box 2, and 2 into 3.

In the second example Mishka can put box 2 into box 3, and box 4 into box 1.

【分析】:之前没用map而是hash就一直RE···当然思路就是找出出现次数最多的数的次数直接输出。

【代码】:

#include <iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<streambuf>
#include<cmath>
#include<string>
using namespace std;
#define ll long long
#define oo 10000000
const int N = +;
int a,m[N];
int ans;
/*
直接排序找出出现次数最多的那个数的次数直接输出
*/
int main()
{
int n;
int ma=-;
memset(m,,sizeof(m));
scanf("%d",&n);
for(int i=;i<n;i++)
{
scanf("%d",&a);
m[a]++;
}
//sort(m,m+5000);
for(int i=;i<+;i++)
{
if(m[i]>ma)
ma=m[i];
}
printf("%d\n",ma);
return ;
}

RE代码

#include <bits/stdc++.h>
using namespace std;
int n, x, ma;
map<int,int> m;
int main()
{
cin >> n;
for (int i = ; i < n; i++)
{
cin >> x;
m[x]++;
ma = max(ma, m[x]);
}
printf("%d\n", ma);
}

AC代码

Educational Codeforces Round 34 C. Boxes Packing【模拟/STL-map/俄罗斯套娃】的更多相关文章

  1. Educational Codeforces Round 34 (Rated for Div. 2) A B C D

    Educational Codeforces Round 34 (Rated for Div. 2) A Hungry Student Problem 题目链接: http://codeforces. ...

  2. Educational Codeforces Round 34 (Rated for Div. 2) C. Boxes Packing

    C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  3. Educational Codeforces Round 34 (Rated for Div. 2)

    A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input sta ...

  4. Educational Codeforces Round 34 D. Almost Difference【模拟/stl-map/ long double】

    D. Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  5. Educational Codeforces Round 34 B. The Modcrab【模拟/STL】

    B. The Modcrab time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  6. Educational Codeforces Round 34 (Rated for Div. 2) B题【打怪模拟】

    B. The Modcrab Vova is again playing some computer game, now an RPG. In the game Vova's character re ...

  7. Educational Codeforces Round 2 A. Extract Numbers 模拟题

    A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...

  8. Educational Codeforces Round 11B. Seating On Bus 模拟

    地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second me ...

  9. Educational Codeforces Round 34

    F - Clear The Matrix 分析 题目问将所有星变成点的花费,限制了行数(只有4行),就可以往状压DP上去靠了. \(dp[i][j]\) 表示到第 \(i\) 列时状态为 \(j\) ...

随机推荐

  1. HTML5/CSS3速成教程

    http://www.w3cfuns.com/thread-5592317-1-1.html

  2. leetcode 【 Insertion Sort List 】 python 实现

    题目: Sort a linked list using insertion sort. 代码:oj测试通过 Runtime: 860 ms # Definition for singly-linke ...

  3. 在IE浏览器下,PDF将弹出窗口遮挡了

    写了个embed标签里面放这个pdf 然后点击其他地方的弹框pdf把他遮盖住了 如下: 先是改z-index,没卵用. 百度了好久,终于找到了个有用的 https://blog.csdn.net/it ...

  4. python矩阵和向量的转置问题

    numpy有很多方法进行转置,这里由于时间和精力限制(主要是我实在比较懒,有一个基本上一直能使的,就懒得看其他的了),其他方法我没研究,这里我总结的东西,如果有问题,欢迎各路大佬拍砖 一.创建矩阵: ...

  5. vlc无法播放.flv视频文件

    解决方法:https://videoconverter.wondershare.com/vlc/flv-not-displaying-video-vlc-media-player.html. 在pre ...

  6. [python工具][pycharm]pycharm licence activation失效的解决方法

    推荐网站: http://idea.lanyus.com/ 1 请将“0.0.0.0 account.jetbrains.com”添加到C:\Windows\System32\Drivers\etc\ ...

  7. scp -v 查看具体的过程

    前几天跟同事讨论scp 多个文件和 scp多个文件夹的压缩包那个快. 老大说,压缩包快,压缩包传输可以避免每个文件的重建连接,不过文件系统的遍历.目录创建.检验会有一些开销. 他建议我scp -v看下 ...

  8. [NOI2012][bzoj2879] 美食节 [费用流+动态加边]

    题面 传送门 思路 先看看这道题 修车 仔细理解一下,这两道题是不是一样的? 这道题的不同之处 但是有一个区别:本题中每一种车有多个需求,但是这个好办,连边的时候容量涨成$p\lbrack i\rbr ...

  9. val

    val 题目描述 有一个值初始为0,接下来n次你可以令其在之前基础上+2或+1或-1.你需要保证,这个值在整个过程中达到的最大值减去达到的最小值不大于k,求方案数,模1,000,000,007. 输入 ...

  10. 有关MongoDB数据库设计的问题

    问题一:是否collection越少越好,尽量把关系数据库中分表表示的关系嵌套进文档里?问题二:如果这样的话,一句SQL能搞定的复杂查询,mongodb也许要查询多次.mongodb的查询速度是否还比 ...