分组统计

分组统计_第1张图片

#include "pch.h"
#include
#include
#include 
#include
using namespace std;
int main()
{
	int m;
	cin >> m;
	while (m--)
	{
		int n;
		cin >> n;
		vector v_elem, v_arr;
		set iset, set1;
		for (int i = 0; i < n; i++)
		{
			int a; cin >> a;
			v_elem.push_back(a);
			iset.insert(a);
		}
		for (int i = 0; i < n; i++)
		{
			int a; cin >> a;
			v_arr.push_back(a);
			set1.insert(a);
		}
		map > imap;
		for (int i = 0; i < v_arr.size(); i++)
		{
			imap[v_arr[i]][v_elem[i]]++;
		}
		/*
		for (auto it = imap.begin(); it != imap.end(); it++)
		{
			cout << it->first << "={";
			int i = 0;
			auto is = iset.begin();
			for (; is!=iset.end(),i

 

你可能感兴趣的:(编程练习)