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. int r[100];
  10. int c[100];
  11. class Solution{
  12. public:
  13. int numSpecial(vector<vector<int>>& mat){
  14. int i;
  15. int x = mat.size();
  16. int y = mat[0].size();
  17. int res = 0;
  18. for(i=(0);i<(x);i++){
  19. r[i] = 0;
  20. }
  21. for(i=(0);i<(y);i++){
  22. c[i] = 0;
  23. }
  24. for(i=(0);i<(x);i++){
  25. int j;
  26. for(j=(0);j<(y);j++){
  27. r[i] += mat[i][j];
  28. }
  29. }
  30. for(i=(0);i<(x);i++){
  31. int j;
  32. for(j=(0);j<(y);j++){
  33. c[j] += mat[i][j];
  34. }
  35. }
  36. for(i=(0);i<(x);i++){
  37. int j;
  38. for(j=(0);j<(y);j++){
  39. if(mat[i][j] && r[i]==c[j] && c[j]==1){
  40. res++;
  41. }
  42. }
  43. }
  44. return res;
  45. }
  46. }
  47. ;
  48. // cLay varsion 20200913-1
  49.  
  50. // --- original code ---
  51. // #define main dummy_main
  52. // {}
  53. // #undef main
  54. //
  55. // int r[100], c[100];
  56. //
  57. // class Solution {
  58. // public:
  59. // int numSpecial(vector<vector<int>>& mat) {
  60. // int x = mat.size(), y = mat[0].size(), res = 0;
  61. // rep(i,x) r[i] = 0;
  62. // rep(i,y) c[i] = 0;
  63. // rep(i,x) rep(j,y) r[i] += mat[i][j];
  64. // rep(i,x) rep(j,y) c[j] += mat[i][j];
  65. // rep(i,x) rep(j,y) if(mat[i][j] && r[i]==c[j]==1) res++;
  66. // return res;
  67. // }
  68. // };
  69.  
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