Simple C++ solution (fills up colsum[i]=2 first and then colsum[i]=1) with explanation
fills up the columns with colsum[i]=2 first with the first for loop\n-> once when "1" is filled up in upper/lower row, upper/lower should be decreased by 1 \n2.
1. fills up the columns with colsum[i]=2 first with the first for loop\n-> once when "1" is filled up in upper/lower row, upper/lower should be decreased by 1 \n2. if colsum[i]==1 and upper>0, fills up the upper row of the column with colsum[i]=1\n3. else if colsum[i]==1 and lower>0, fills up the lower row of the column with colsum[i]=1\n4. else if colsum[i]==1, return an empty array\n5. after the for loop, if upper or lower is not 0, return an empty array (because upper+lower is greater than sum(colsum[:])) \n```\nclass Solution \n{\n    public:\n    vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum) \n    {\n        int n=colsum.size();\n        vector<vector<int>> result(2,vector<int>(n,0));\n        for(int i=0;i<n;i++)\n        {\n            if(colsum[i]==2)\n            {\n                result[0][i]=1;\n                result[1][i]=1;\n                upper--;\n                lower--;\n            }\n        }\n        for(int i=0;i<n;i++)\n            if(colsum[i]==1&&upper>0) result[0][i]=1, upper--;\n            else if(colsum[i]==1&&lower>0) result[1][i]=1, lower--;\n            else if(colsum[i]==1||upper<0||lower<0) return vector<vector<int>>(0,vector<int>(0,0));   \n\n        if(upper!=0||lower!=0) return vector<vector<int>>(0,vector<int>(0,0));   \n        return result;\n    }\n};\n```
[]