第二题我也只有9% 不知道为啥 #include<iostream> #include<string> #include<vector> #include<unordered_map> #include<map> #include<unordered_set> using namespace std; struct cmp { bool operator()(int a, int b) { return a > b; } }; int main() { int n, q; cin >> n >> q; vector<string> userSearch(q); for (int i = 0; i < q; i++) cin >> userSearch[i]; unordered_map<string>>hash; vector<string> productList; for (int i = 0; i < n; i++) { string product; cin >> product; productList.push_back(product); int keyCount; cin >> keyCount; unordered_set<string> set; for (int j = 0; j < keyCount; j++) { string keyWord; cin >> keyWord; set.emplace(keyWord); } hash[product] = set; } map<int>rank; for (auto & product : productList) { int cover = 0; unordered_set<string> & currSet = hash[product]; for (auto & currKey : userSearch) { if (currSet.count(currKey)) cover++; } rank[cover] = product; } for (auto & kv : rank) { cout << kv.second << endl; } }</string></int></string></string></string></string></unordered_set></map></unordered_map></vector></string></iostream>