样例通过了,但测试点全WA,求大佬解惑
查看原帖
样例通过了,但测试点全WA,求大佬解惑
1600214
HY_ACM楼主2025/7/21 15:28
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int main()
{
	unordered_map<string, vector<int>> Hash;
	
	int n = 0; cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		int len = 0; cin >> len;
		
		while(len--)
		{
			string word; cin >> word;
			
			Hash[word].push_back(i);
		}
	} 
	
	int m = 0; cin >> m;
	
	while(m--)
	{
		string word; cin >> word;
		
		if(Hash.count(word))
		{
			for(const auto& id: Hash[word]) cout << id << ' '; 
		}
		
		cout << endl;
	}
	
	return 0;
}
2025/7/21 15:28
加载中...