文章
43
粉丝
180
获赞
21
访问
194.9k
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int m, n, x, a[N], map[110][N];
int c[N];
int main()
{
cin >> m;
while (m -- )
{
cin >> n;
for (int i = 1; i <= n; i ++ )
{
cin >> a[i];
map[0][a[i]] ++;
}
int p = 0, mx = 0;
for (int i = 0; i < N; i ++ ) if (map[0][i]) c[p ++ ] = i;
for (int i = 1; i <= n; i ++ )
{
cin >> x;
mx = max(mx, x);
map[x][a[i]] ++;
}
for (int i = 1; i <= mx; i ++ )
{
cout << i << "={";
for (int j = 0; j < p - 1; j ++ ) cout << c[j] << "=" << map[i][c[j]] << ",";
cout << c[p - 1] << "=" << map[i][c[p - 1]] << "}" << endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发