记录编号 458820 评测结果 AAAAAAAAAA
题目名称 [NOIP 2007]统计数字 最终得分 100
用户昵称 GravatarkZime 是否通过 通过
代码语言 C++ 运行时间 0.151 s
提交时间 2017-10-11 20:55:05 内存使用 19.39 MiB
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

char buf[(int) 1e7], *fs = buf, op[(int) 1e7], *ft = op; 

inline ll gn() { 
    ll k = 0, f = 1;
    char c = *(fs)++;
    for (; !isdigit(c); c = *fs++) if (c == '-') f = -1;
    for (; isdigit(c); c = *fs++) k = k * 10 + c - '0';
    return k * f;
}

inline void write(ll k, char c) { 
    static char *p = new char[20]();
    do { 
        *(++p) = (k % 10) | 0x30;
        k /= 10;
    }while(k);
    while(*p) *(ft++) = *(p--);
    *(ft++) = c;
}
 
long long n, tmp;
map <long long, int> times;
 
int main() { 
    freopen("pcount.in", "r", stdin);
    freopen("pcount.out", "w", stdout);
    fread(buf, 1, (int) 1e7, stdin);
    n = gn();
    for (int i = 1; i <= n; i++) { 
        times[gn()]++;
    }
    map<ll, int>::iterator ed = times.end();
    for (map<long long, int>::iterator it = times.begin(); it != ed; it++) { 
        write(it->first, ' ');
        write(it->second, '\n');
    }
    fwrite(op, 1, ft - op, stdout);
}