求助,玄关
  • 板块灌水区
  • 楼主Eeluctric
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/20 15:55
  • 上次更新2024/10/20 18:06:10
查看原帖
求助,玄关
1329118
Eeluctric楼主2024/10/20 15:55

P3879 [TJOI2010] 阅读理解

#include <bits/stdc++.h>
using namespace std;
map<string,vector<int> >mp;
int main(){
	int n,m;
	cin >> n;
	string str;
	for(int i=1;i<=n;i++){
		int L;
		cin >> L;
		for(int j=0;j<L;j++){
			cin >> str;
			if(mp[str][i]!=NULL){
				while(0);
			}
			else{
				mp[str].push_back(i);
			}
			
		}
	}
	cin >> m;
	for(int i=0;i<m;i++){
		cin >> str;
//		if(mp[str][0]!=NULL){
//			cout << mp[str][0] << " ";
//		}
		for(int j=1;j<mp[str].size();j++){
//			if(mp[str][j]!=mp[str][j-1]){
				cout << mp[str][j] << " ";
//			}
		}
		cout << endl;
	}
	return 0;
}

2024/10/20 15:55
加载中...