#34217:


aa613613613 (coffeesun)

School : 國立彰化師範大學
ID : 119242
IP address : [163.19.184.254]
Last Login :
2024-02-21 08:07:37
a541. 字典 | From: [120.104.245.130] | Post Date : 2023-03-06 11:05

#include <iostream> #include <set> #include <string> using namespace std; int main() { int n, q; cin >> n; set<string> words; for (int i = 0; i < n; i++) { string word; cin >> word; words.insert(word); } cin >> q; for (int i = 0; i < q; i++) { string query; cin >> query; if (words.count(query)) { cout << "yes" << endl; } else { words.insert(query); cout << "no" << endl; } } return 0; }

 
ZeroJudge Forum