1 条题解
-
0
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> PII; unordered_map<int,int> h; vector<PII> vec; bool cmp(const PII&a,const PII&b) { return a.first<b.first; } int main() { int n; scanf("%d",&n); while(n--) { int t; scanf("%d",&t); h[t]++; } for(auto p:h) vec.push_back(p); sort(vec.begin(),vec.end(),cmp); for(auto p:vec) if(p.second!=0) printf("%d %d\n",p.first,p.second); return 0; }
- 1
信息
- ID
- 261
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 7
- 标签
- 递交数
- 15
- 已通过
- 8
- 上传者