79648291

Date: 2025-06-02 06:59:33
Score: 0.5
Natty:
Report link
#include <bits/stdc++.h>
using namespace std;
//Long ago in the digital realm of Byteonia

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    unordered_map<int, string> hashTable;

    for (int i = 0; i < N; i++) {
        string cmd; cin >> cmd;

        if (cmd == "INSERT") {
            int key; string value;
            cin >> key >> value;
            hashTable[key] = value;  // Insert or update
        }
        else if (cmd == "DELETE") {
            int key; cin >> key;
            hashTable.erase(key);    // Delete if exists, else no effect
        }
        else if (cmd == "SEARCH") {
            int key; cin >> key;
            auto it = hashTable.find(key);
            if (it == hashTable.end())
                cout << "NOT_FOUND\n";
            else
                cout << it->second << "\n";
        }
    }

    return 0;
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user30694823