• + 123 comments

    Anyone failing Test case #1 (in C++ at least), be aware N is not the maximum amount of queries that can be made. It could give you 5 definitions but send you 10 queries. This worked for me:

    int n;
    string name;
    long num;
    cin >> n;
    cin.ignore();
    map <string, long> pBook;
    for (int i = 0; i < n; i++) {
        cin >> name;
        cin >> num;
        pBook[name] = num;
    }
    while(cin >> name) {
        if (pBook.find(name) != pBook.end()) {
            cout << name << "=" << pBook.find(name)->second << endl;
        } else {
            cout << "Not found" << endl;
        }
    }