R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149(削除) 149 (削除ここまで) 135 bytes
Or R>=4.1, 121107 bytes by replacing four function occurrences with \s.
Edit: -14 bytes thenks to @Giuseppe .
function(M,a,b,`/`=combn,`?`=all)M==sapply(seq(!M),g<-function(i){M[i]=1;?!applycombn(nrow(M)/a,2a,function(x)applycombn(ncol(M)/b,2b,function(y)?M[x,y]))})?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)M==sapply(seq(!M),g<-function(i){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?M[x,y]))})?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) (削除) 149 (削除ここまで) 135 bytes
Or R>=4.1, 107 bytes by replacing four function occurrences with \s.
Edit: -14 bytes thenks to @Giuseppe .
function(M,a,b,`?`=all)M==sapply(seq(!M),g<-function(i){M[i]=1;?!combn(nrow(M),a,function(x)combn(ncol(M),b,function(y)?M[x,y]))})?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)!sapplyM==sapply(seq(!M),g<-function(i){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?M[x,y]))})-M?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)!sapply(seq(!M),g<-function(i){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?M[x,y]))})-M?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)M==sapply(seq(!M),g<-function(i){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?M[x,y]))})?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) 155(削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 127121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)!sapply(seq(!M),g<-function(i,A=`[<-`(M,i,1)){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?A[xM[x,y]))})-M?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) 155 bytes
Or R>=4.1, 127 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)!sapply(seq(!M),g<-function(i,A=`[<-`(M,i,1))?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?A[x,y])))-M?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).
R, (削除) 196 (削除ここまで) (削除) 166 (削除ここまで) (削除) 155 (削除ここまで) 149 bytes
Or R>=4.1, 121 bytes by replacing four function occurrences with \s.
function(M,a,b,`/`=combn,`?`=all)!sapply(seq(!M),g<-function(i){M[i]=1;?!apply(nrow(M)/a,2,function(x)apply(ncol(M)/b,2,function(y)?M[x,y]))})-M?g(0)
Straightforward brute-force.
Takes advantage of redefining `?`=all and operator precedence (? has the lowest and is both unary and binary operator).