Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- using namespace std;
- typedef long long ll;
- ll GetMask(ll value) {
- ll ten_in_power = 1'000'000'000'000'000'000ll;
- ll mask = 0;
- while (ten_in_power > 0) {
- if (value / ten_in_power % 2 == 1) mask += ten_in_power;
- ten_in_power /= 10;
- }
- return mask;
- }
- int main() {
- int t = 0; cin >> t;
- unordered_map<ll, int> m;
- while (t--) {
- char command = 0;
- ll value = 0;
- cin >> command >> value;
- switch (command) {
- case '+':
- ++m[GetMask(value)];
- // ll mask = GetMask(value);
- // int& count = m[mask];
- // count += 1;
- // if (!m.contains(mask)) m[mask] = 1;
- // else m[mask] += 1;
- break;
- case '-':
- --m[GetMask(value)];
- break;
- case '?':
- cout << m[GetMask(value)] << endl;
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement