0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 16:32:17 +00:00

P3879 [TJOI2010]阅读理解

R44431435
This commit is contained in:
Baoshuo Ren 2020-12-30 18:59:08 +08:00 committed by Baoshuo Ren
parent b3c5de0cea
commit 20dbd53f88
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -5,13 +5,13 @@ using namespace std;
int main() { int main() {
int n, l; int n, l;
string s; string s;
map<string, vector<int>> m; map<string, set<int>> m;
cin >> n; cin >> n;
for (int i = 1; i <= n; i++) { for (int i = 1; i <= n; i++) {
cin >> l; cin >> l;
for (int j = 0; j < l; j++) { for (int j = 0; j < l; j++) {
cin >> s; cin >> s;
m[s].push_back(i); m[s].insert(i);
} }
} }
cin >> n; cin >> n;
@ -21,10 +21,8 @@ int main() {
cout << endl; cout << endl;
} }
else { else {
for (int j = 0; j < m[s].size() - 1; j++) { for (set<int>::iterator it = m[s].begin(); it != --m[s].end(); it++) {
if(m[s][j] != m[s][j+1]) { cout << *it << ' ';
cout << m[s][j] << ' ';
}
} }
cout << *--m[s].end() << endl; cout << *--m[s].end() << endl;
} }