c++(272ms 80%) simple, easy, small
Runtime: 272 ms, faster than 79.71% of C++ online submissions for Avoid Flood in The City.\nMemory Usage: 109.2 MB, less than 85.61% of C++ online submissions f
Runtime: 272 ms, faster than 79.71% of C++ online submissions for Avoid Flood in The City.\nMemory Usage: 109.2 MB, less than 85.61% of C++ online submissions for Avoid Flood in The City.\n```\nclass Solution {\npublic:\n  vector<int> avoidFlood(vector<int>& rains) {\n    unordered_map<int,int>likes;\n    set<int>days;\n    \n    for(int i = 0; i != rains.size(); i++)\n      if(rains[i]){\n        if(likes.count(rains[i])){\n          auto it = days.upper_bound(likes[rains[i]]);\n          if(it == days.end()) return {};\n          rains[*it] = rains[i];\n          days.erase(*it);\n        }\n        likes[rains[i]] = i;\n        rains[i] = -1;\n      }\n      else days.insert(i), rains[i] = 1;\n    \n    return rains;\n  }\n};\n```
['C', 'C++']