set + map c++
\n    vector<int> avoidFlood(vector<int>& rains) {\n        unordered_map<int,int> full_days; // lakeno -> day of first occurence\n       set<int> dry_days; // 
```\n    vector<int> avoidFlood(vector<int>& rains) {\n        unordered_map<int,int> full_days; // lakeno -> day of first occurence\n       set<int> dry_days; // dry days \n        vector<int> result;\n        for(int i =0;i < rains.size();++i){\n            if(rains[i] == 0){\n                dry_days.insert(i);\n                result.push_back(1);\n            } else{\n                if(full_days.find(rains[i]) != full_days.end()){\n                    auto it = dry_days.upper_bound(full_days[rains[i]]);\n                    if(it == dry_days.end()){\n                        return {};\n                    } else{\n                        result[*it] = rains[i];\n                        dry_days.erase(*it);\n                    }\n                    \n                }\n                full_days[rains[i]] = i;\n                result.push_back(-1);\n            }\n            \n        }\n        \n        return result;\n\n    }\n```
['C']