[Offer收割]编程练习赛4 register

Ended

Participants:899

Verdict:Accepted
Score:100 / 100
Submitted:2016-08-07 14:07:19

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstring>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
using namespace std;
map<int,int>ma;
int n;
int a[100005];
int ans[100005];
struct node {
    int x,num;
    node(int xx,int numx){
        x=xx;
        num=numx;
    }
    bool operator < (const node &xx) const {
        if(num!=xx.num) return num>xx.num;
        return x>xx.x;
    }
};
set<node>s;
int main(){
    while(scanf("%d",&n)!=EOF){
        ma.clear();
        for (int i=0;i<n;i++){
            scanf("%d",&a[i]);
            ma[a[i]]++;
        }
        map<int,int>::iterator p=ma.begin();
        s.clear();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX