社区讨论
0分求调,自己看不出错误
P3879[TJOI2010] 阅读理解参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @m2ie2zoi
- 此快照首次捕获于
- 2024/10/21 10:20 去年
- 此快照最后确认于
- 2025/11/04 16:39 4 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
int n,k;
map<string ,int>m;
vector<int>v[100005];
int main()
{
cin>>n;
int cnt = 0;
for(int i = 1;i <= n;i++)
{
int x;
cin>>x;
for(int j = 1;j <= x;j++)
{
string s;
cin>>s;
if(m[s] == 0) m[s] = ++cnt;
v[m[s]].push_back(i);
}
}
cin>>k;
for(int i = 1;i <= k;i++)
{
string s;
cin>>s;
if(m[s] == 0)
{
cout<<"\n";
continue;
}
for(auto x : v[m[s]])
{
cout<<x<<" ";
}
cout<<"\n";
}
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...