Cody

# Problem 42290. GJam 2015 Rd1B: Noisy Neighbors

Solution 2964523

Submitted on 18 Sep 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
m=zeros(5,2);N=8; NNexp=7; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test1 (line 3) NN=Noisy_Neighbors(m,N);

2   Fail
m=zeros(3,5);N=14; NNexp=18; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test2 (line 3) NN=Noisy_Neighbors(m,N);

3   Fail
m=zeros(1,16);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test3 (line 3) NN=Noisy_Neighbors(m,N);

4   Fail
m=zeros(3,5);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test4 (line 3) NN=Noisy_Neighbors(m,N);

5   Fail
m=zeros(8,2);N=12; NNexp=10; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test5 (line 3) NN=Noisy_Neighbors(m,N);

6   Fail
m=zeros(16,1);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test6 (line 3) NN=Noisy_Neighbors(m,N);

7   Fail
m=zeros(3,3);N=6; NNexp=3; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test7 (line 3) NN=Noisy_Neighbors(m,N);

8   Fail
m=zeros(2,6);N=12; NNexp=16; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test8 (line 3) NN=Noisy_Neighbors(m,N);

9   Fail
m=zeros(15,1);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test9 (line 3) NN=Noisy_Neighbors(m,N);

10   Fail
m=zeros(5,3);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test10 (line 3) NN=Noisy_Neighbors(m,N);

11   Fail
m=zeros(4,3);N=5; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test11 (line 3) NN=Noisy_Neighbors(m,N);

12   Fail
m=zeros(3,5);N=11; NNexp=8; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test12 (line 3) NN=Noisy_Neighbors(m,N);

13   Fail
m=zeros(7,2);N=13; NNexp=16; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test13 (line 3) NN=Noisy_Neighbors(m,N);

14   Fail
m=zeros(15,1);N=6; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test14 (line 3) NN=Noisy_Neighbors(m,N);

15   Fail
m=zeros(15,1);N=15; NNexp=14; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test15 (line 3) NN=Noisy_Neighbors(m,N);

16   Fail
m=zeros(4,4);N=9; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test16 (line 3) NN=Noisy_Neighbors(m,N);

17   Fail
m=zeros(5,3);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test17 (line 3) NN=Noisy_Neighbors(m,N);

18   Fail
m=zeros(3,5);N=6; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test18 (line 3) NN=Noisy_Neighbors(m,N);

19   Fail
m=zeros(16,1);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test19 (line 3) NN=Noisy_Neighbors(m,N);

20   Fail
m=zeros(1,15);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test20 (line 3) NN=Noisy_Neighbors(m,N);

21   Fail
m=zeros(4,3);N=12; NNexp=17; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test21 (line 3) NN=Noisy_Neighbors(m,N);

22   Fail
m=zeros(5,3);N=13; NNexp=14; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test22 (line 3) NN=Noisy_Neighbors(m,N);

23   Fail
m=zeros(2,4);N=5; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test23 (line 3) NN=Noisy_Neighbors(m,N);

24   Fail
m=zeros(5,3);N=5; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test24 (line 3) NN=Noisy_Neighbors(m,N);

25   Fail
m=zeros(16,1);N=16; NNexp=15; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test25 (line 3) NN=Noisy_Neighbors(m,N);

26   Fail
m=zeros(2,5);N=8; NNexp=7; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test26 (line 3) NN=Noisy_Neighbors(m,N);

27   Fail
m=zeros(5,3);N=4; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test27 (line 3) NN=Noisy_Neighbors(m,N);

28   Fail
m=zeros(5,3);N=10; NNexp=6; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test28 (line 3) NN=Noisy_Neighbors(m,N);

29   Fail
m=zeros(4,4);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test29 (line 3) NN=Noisy_Neighbors(m,N);

30   Fail
m=zeros(3,5);N=9; NNexp=3; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test30 (line 3) NN=Noisy_Neighbors(m,N);

31   Fail
m=zeros(4,2);N=2; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test31 (line 3) NN=Noisy_Neighbors(m,N);

32   Fail
m=zeros(4,4);N=15; NNexp=20; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test32 (line 3) NN=Noisy_Neighbors(m,N);

33   Fail
m=zeros(2,2);N=4; NNexp=4; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test33 (line 3) NN=Noisy_Neighbors(m,N);

34   Fail
m=zeros(5,3);N=11; NNexp=8; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test34 (line 3) NN=Noisy_Neighbors(m,N);

35   Fail
m=zeros(4,4);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test35 (line 3) NN=Noisy_Neighbors(m,N);

36   Fail
m=zeros(1,16);N=9; NNexp=1; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test36 (line 3) NN=Noisy_Neighbors(m,N);

37   Fail
m=zeros(4,4);N=16; NNexp=24; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test37 (line 3) NN=Noisy_Neighbors(m,N);

38   Fail
m=zeros(1,15);N=6; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test38 (line 3) NN=Noisy_Neighbors(m,N);

39   Fail
m=zeros(15,1);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test39 (line 3) NN=Noisy_Neighbors(m,N);

40   Fail
m=zeros(5,3);N=6; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test40 (line 3) NN=Noisy_Neighbors(m,N);

41   Fail
m=zeros(16,1);N=9; NNexp=1; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test41 (line 3) NN=Noisy_Neighbors(m,N);

42   Fail
m=zeros(3,5);N=15; NNexp=22; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test42 (line 3) NN=Noisy_Neighbors(m,N);

43   Fail
m=zeros(1,15);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test43 (line 3) NN=Noisy_Neighbors(m,N);

44   Fail
m=zeros(1,15);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test44 (line 3) NN=Noisy_Neighbors(m,N);

45   Fail
m=zeros(2,5);N=9; NNexp=10; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test45 (line 3) NN=Noisy_Neighbors(m,N);

46   Fail
m=zeros(3,5);N=10; NNexp=6; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test46 (line 3) NN=Noisy_Neighbors(m,N);

47   Fail
m=zeros(1,15);N=15; NNexp=14; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test47 (line 3) NN=Noisy_Neighbors(m,N);

48   Fail
m=zeros(3,2);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test48 (line 3) NN=Noisy_Neighbors(m,N);

49   Fail
m=zeros(5,3);N=2; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test49 (line 3) NN=Noisy_Neighbors(m,N);

50   Fail
m=zeros(5,3);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test50 (line 3) NN=Noisy_Neighbors(m,N);

51   Fail
m=zeros(5,2);N=4; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test51 (line 3) NN=Noisy_Neighbors(m,N);

52   Fail
m=zeros(3,5);N=4; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test52 (line 3) NN=Noisy_Neighbors(m,N);

53   Fail
m=zeros(2,7);N=13; NNexp=16; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test53 (line 3) NN=Noisy_Neighbors(m,N);

54   Fail
m=zeros(3,3);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test54 (line 3) NN=Noisy_Neighbors(m,N);

55   Fail
m=zeros(7,2);N=11; NNexp=10; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test55 (line 3) NN=Noisy_Neighbors(m,N);

56   Fail
m=zeros(4,4);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test56 (line 3) NN=Noisy_Neighbors(m,N);

57   Fail
m=zeros(1,1);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test57 (line 3) NN=Noisy_Neighbors(m,N);

58   Fail
m=zeros(2,6);N=9; NNexp=7; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test58 (line 3) NN=Noisy_Neighbors(m,N);

59   Fail
m=zeros(3,5);N=3; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test59 (line 3) NN=Noisy_Neighbors(m,N);

60   Fail
m=zeros(5,3);N=15; NNexp=22; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test60 (line 3) NN=Noisy_Neighbors(m,N);

61   Fail
m=zeros(5,2);N=6; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test61 (line 3) NN=Noisy_Neighbors(m,N);

62   Fail
m=zeros(3,4);N=12; NNexp=17; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test62 (line 3) NN=Noisy_Neighbors(m,N);

63   Fail
m=zeros(2,3);N=6; NNexp=7; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test63 (line 3) NN=Noisy_Neighbors(m,N);

64   Fail
m=zeros(1,1);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test64 (line 3) NN=Noisy_Neighbors(m,N);

65   Fail
m=zeros(15,1);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test65 (line 3) NN=Noisy_Neighbors(m,N);

66   Fail
m=zeros(1,16);N=16; NNexp=15; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test66 (line 3) NN=Noisy_Neighbors(m,N);

67   Fail
m=zeros(2,2);N=2; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test67 (line 3) NN=Noisy_Neighbors(m,N);

68   Fail
m=zeros(3,3);N=9; NNexp=12; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test68 (line 3) NN=Noisy_Neighbors(m,N);

69   Fail
m=zeros(16,1);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test69 (line 3) NN=Noisy_Neighbors(m,N);

70   Fail
m=zeros(9,1);N=6; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test70 (line 3) NN=Noisy_Neighbors(m,N);

71   Fail
m=zeros(5,3);N=12; NNexp=11; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test71 (line 3) NN=Noisy_Neighbors(m,N);

72   Fail
m=zeros(2,2);N=3; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test72 (line 3) NN=Noisy_Neighbors(m,N);

73   Fail
m=zeros(3,5);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test73 (line 3) NN=Noisy_Neighbors(m,N);

74   Fail
m=zeros(7,2);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test74 (line 3) NN=Noisy_Neighbors(m,N);

75   Fail
m=zeros(4,3);N=6; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test75 (line 3) NN=Noisy_Neighbors(m,N);

76   Fail
m=zeros(2,3);N=4; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test76 (line 3) NN=Noisy_Neighbors(m,N);

77   Fail
m=zeros(1,15);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test77 (line 3) NN=Noisy_Neighbors(m,N);

78   Fail
m=zeros(16,1);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test78 (line 3) NN=Noisy_Neighbors(m,N);

79   Fail
m=zeros(5,3);N=9; NNexp=3; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test79 (line 3) NN=Noisy_Neighbors(m,N);

80   Fail
m=zeros(15,1);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test80 (line 3) NN=Noisy_Neighbors(m,N);

81   Fail
m=zeros(2,4);N=6; NNexp=4; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test81 (line 3) NN=Noisy_Neighbors(m,N);

82   Fail
m=zeros(1,16);N=7; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test82 (line 3) NN=Noisy_Neighbors(m,N);

83   Fail
m=zeros(3,5);N=12; NNexp=11; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test83 (line 3) NN=Noisy_Neighbors(m,N);

84   Fail
m=zeros(1,16);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test84 (line 3) NN=Noisy_Neighbors(m,N);

85   Fail
m=zeros(4,4);N=1; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test85 (line 3) NN=Noisy_Neighbors(m,N);

86   Fail
m=zeros(3,5);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test86 (line 3) NN=Noisy_Neighbors(m,N);

87   Fail
m=zeros(3,5);N=8; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test87 (line 3) NN=Noisy_Neighbors(m,N);

88   Fail
m=zeros(1,16);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test88 (line 3) NN=Noisy_Neighbors(m,N);

89   Fail
m=zeros(5,3);N=3; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test89 (line 3) NN=Noisy_Neighbors(m,N);

90   Fail
m=zeros(5,3);N=0; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test90 (line 3) NN=Noisy_Neighbors(m,N);

91   Fail
m=zeros(1,13);N=9; NNexp=4; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test91 (line 3) NN=Noisy_Neighbors(m,N);

92   Fail
m=zeros(3,5);N=2; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test92 (line 3) NN=Noisy_Neighbors(m,N);

93   Fail
m=zeros(1,9);N=6; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test93 (line 3) NN=Noisy_Neighbors(m,N);

94   Fail
m=zeros(6,2);N=12; NNexp=16; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test94 (line 3) NN=Noisy_Neighbors(m,N);

95   Fail
m=zeros(4,3);N=8; NNexp=4; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test95 (line 3) NN=Noisy_Neighbors(m,N);

96   Fail
m=zeros(3,5);N=5; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test96 (line 3) NN=Noisy_Neighbors(m,N);

97   Fail
m=zeros(5,3);N=14; NNexp=18; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test97 (line 3) NN=Noisy_Neighbors(m,N);

98   Fail
m=zeros(4,3);N=7; NNexp=2; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test98 (line 3) NN=Noisy_Neighbors(m,N);

99   Fail
m=zeros(6,2);N=4; NNexp=0; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test99 (line 3) NN=Noisy_Neighbors(m,N);

100   Fail
m=zeros(3,5);N=13; NNexp=14; NN=Noisy_Neighbors(m,N); assert(isequal(NNexp,NN))

Undefined function 'Noisy_Neighbors' for input arguments of type 'double'. Error in Test100 (line 3) NN=Noisy_Neighbors(m,N);

101   Pass
toc

Elapsed time is 3.668800 seconds.

102   Pass
% function GJam_Rd1B_2015b % fn='B-small-practice.in'; % [data] = read_file(fn); % % fidG = fopen('B-small-practice.out', 'w'); % % tic % for i=1:size(data,2) % Cell array has N cols of cases % NN = Noisy_Neighbors(data{i}); % fprintf(fidG,'Case #%i: %i\n',i,NN); % % fprintf('Case #%i: %i\n',i,NN); % end % toc % fclose(fidG); % end % % function val=Noisy_Neighbors(v) % r=v(1);c=v(2);N=v(3); % m=zeros(r,c); % if N==0 % val=0; % return; % end % % ptrset=find(m==0); % % val=Inf; % tlocs=nchoosek(ptrset,N); % for i=1:size(tlocs,1) % m=m*0; % tlocv=tlocs(i,:); % m(tlocv)=1; % vchk=nnz(conv2(m,[1 1])==2)+nnz(conv2(m,[1;1])==2); % % if vchk<val % val=vchk; % end % if val==0,break;end; % end % % end % % function [d] = read_file(fn) % d={}; % fid=fopen(fn); % fgetl(fid); % Total Count ignore % ptr=0; % while ~feof(fid) % ptr=ptr+1; % v=str2num(fgetl(fid)); % r,c,N % % d{ptr}=v; % % end % feof % fclose(fid); % % end % read_file

103   Pass
toc

Elapsed time is 3.700790 seconds.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!