回答編集履歴

2

コメントを受けて修正

2020/09/29 02:10

投稿

kirara0048
kirara0048

スコア1399

test CHANGED
@@ -246,25 +246,25 @@
246
246
 
247
247
  c1D = np.convolve(b1D, np.array([1, 1, 1]))[:-1].reshape(arr.shape)[:, 2:-1]
248
248
 
249
- # array([[1, 2, 3, 2, 1, 0, 1, 1],
249
+ # array([[1, 2, 3, 2, 1, 0, 1],
250
-
250
+
251
- # [1, 0, 1, 2, 3, 2, 1, 0],
251
+ # [1, 0, 1, 2, 3, 2, 1],
252
-
252
+
253
- # [0, 0, 0, 1, 1, 1, 0, 0],
253
+ # [0, 0, 0, 1, 1, 1, 0],
254
-
254
+
255
- # [1, 2, 3, 2, 1, 0, 0, 0],
255
+ # [1, 2, 3, 2, 1, 0, 0],
256
-
256
+
257
- # [1, 1, 1, 0, 0, 0, 0, 0],
257
+ # [1, 1, 1, 0, 0, 0, 0],
258
-
258
+
259
- # [1, 1, 1, 2, 2, 2, 1, 0],
259
+ # [1, 1, 1, 2, 2, 2, 1],
260
-
260
+
261
- # [3, 2, 2, 1, 2, 1, 1, 0],
261
+ # [3, 2, 2, 1, 2, 1, 1],
262
-
262
+
263
- # [1, 1, 1, 1, 2, 2, 3, 2],
263
+ # [1, 1, 1, 1, 2, 2, 3],
264
-
264
+
265
- # [1, 1, 0, 0, 0, 0, 0, 0],
265
+ # [1, 1, 0, 0, 0, 0, 0],
266
-
266
+
267
- # [0, 0, 0, 1, 2, 3, 3, 2]])
267
+ # [0, 0, 0, 1, 2, 3, 3]])
268
268
 
269
269
  ```
270
270
 

1

コメントを受けて修正

2020/09/29 02:10

投稿

kirara0048
kirara0048

スコア1399

test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  # その1
60
60
 
61
- idx = np.all(np.convolve(np.ediff1d(arr.ravel()) == 1, np.array([1, 1, 1]))[:-1].reshape(arr.shape)[:, 2:] != 3, 1)
61
+ idx = np.all(np.convolve(np.ediff1d(arr.ravel()) == 1, np.array([1, 1, 1]))[:-1].reshape(arr.shape)[:, 2:-1] != 3, 1)
62
62
 
63
63
  # その2
64
64
 
@@ -244,7 +244,7 @@
244
244
 
245
245
 
246
246
 
247
- c1D = np.convolve(b1D, np.array([1, 1, 1]))[:-1].reshape(arr.shape)[:, 2:]
247
+ c1D = np.convolve(b1D, np.array([1, 1, 1]))[:-1].reshape(arr.shape)[:, 2:-1]
248
248
 
249
249
  # array([[1, 2, 3, 2, 1, 0, 1, 1],
250
250