結果

問題 No.1668 Grayscale
ユーザー harurunharurun
提出日時 2021-09-03 22:57:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,225 ms / 4,000 ms
コード長 355 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 226,944 KB
最終ジャッジ日時 2024-12-15 16:32:10
合計ジャッジ時間 5,616 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,352 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 40 ms
52,096 KB
testcase_03 AC 38 ms
51,840 KB
testcase_04 AC 39 ms
51,968 KB
testcase_05 AC 37 ms
52,480 KB
testcase_06 AC 451 ms
226,816 KB
testcase_07 AC 446 ms
226,944 KB
testcase_08 AC 260 ms
152,516 KB
testcase_09 AC 1,225 ms
222,744 KB
testcase_10 AC 551 ms
126,848 KB
testcase_11 AC 43 ms
60,032 KB
testcase_12 AC 66 ms
71,040 KB
testcase_13 AC 85 ms
80,384 KB
testcase_14 AC 188 ms
102,612 KB
testcase_15 AC 134 ms
86,448 KB
testcase_16 AC 128 ms
82,688 KB
testcase_17 AC 94 ms
81,664 KB
testcase_18 AC 38 ms
52,480 KB
testcase_19 AC 38 ms
52,352 KB
testcase_20 AC 53 ms
64,640 KB
testcase_21 AC 66 ms
69,760 KB
testcase_22 AC 38 ms
51,968 KB
testcase_23 AC 36 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,N=map(int,input().split());C=[list(map(int,input().split()))for _ in[0]*H];d=[[]for _ in[0]*N];a=s=1
for i in range(H):
 for j in range(W):d[C[i][j]-1].append((i,j))
for i in range(N):
 f=0
 for x,y in d[i]:
  for u,t in((1,0),(0,1),(-1,0),(0,-1)):
   if 0<=x+u<H and 0<=y+t<W and s<=C[x+u][y+t]<C[x][y]:a+=1;f=1;s=C[x][y];break
  if f:break
print(a)
0