fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. class Solution{
  10. public:
  11. vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum){
  12. int i;
  13. int N = colsum.size();
  14. vector<int> tmp(N);
  15. vector<vector<int>> res{tmp, tmp};
  16. vector<vector<int>> empty;
  17. for(i=(0);i<(N);i++){
  18. if(colsum[i]==2){
  19. res[0][i] = res[1][i] = 1;
  20. upper--;
  21. lower--;
  22. }
  23. }
  24. for(i=(0);i<(N);i++){
  25. if(colsum[i]==1){
  26. if(upper > 0){
  27. upper--;
  28. res[0][i] = 1;
  29. continue;
  30. }
  31. lower--;
  32. res[1][i] = 1;
  33. }
  34. }
  35. if(upper || lower){
  36. return empty;
  37. }
  38. return res;
  39. }
  40. }
  41. ;
  42. // cLay varsion 20191108-1
  43.  
  44. // --- original code ---
  45. // #define main dummy_main
  46. // {}
  47. // #undef main
  48. //
  49. // class Solution {
  50. // public:
  51. // vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum) {
  52. // int N = colsum.size();
  53. // vector<int> tmp(N);
  54. // vector<vector<int>> res{tmp, tmp}, empty;
  55. //
  56. // rep(i,N) if(colsum[i]==2){
  57. // res[0][i] = res[1][i] = 1;
  58. // upper--;
  59. // lower--;
  60. // }
  61. //
  62. // rep(i,N) if(colsum[i]==1){
  63. // if(upper > 0) upper--, res[0][i] = 1, continue;
  64. // lower--, res[1][i] = 1;
  65. // }
  66. //
  67. // if(upper || lower) return empty;
  68. // return res;
  69. // }
  70. // };
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty