64ms beats 99.80%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    long long minSum(vector<int>& nums1, vector<int>& nums2) {\n        pair<long long, int> n1 = {0, 0}, n2 = {0, 0};\n        for(auto i : nums1){\n            if(i == 0) n1.second++;\n            else n1.first += i;\n        }\n\n        for(auto i : nums2){\n            if(i == 0) n2.second++;\n            else n2.first += i;\n        }\n\n        if(n1.second == 0 && n1.first < n2.first + n2.second) return -1;\n        if(n2.second == 0 && n2.first < n1.first + n1.second) return -1;\n\n        return max((n1.first + n1.second), (n2.first + n2.second));\n    }\n};\n\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['Array', 'Greedy', 'C++']