結果

問題 No.1668 Grayscale
ユーザー harurunharurun
提出日時 2021-09-03 22:59:52
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,039 ms / 4,000 ms
コード長 352 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 228,608 KB
最終ジャッジ日時 2023-08-22 00:21:39
合計ジャッジ時間 6,241 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,280 KB
testcase_01 AC 67 ms
71,244 KB
testcase_02 AC 67 ms
71,320 KB
testcase_03 AC 66 ms
71,488 KB
testcase_04 AC 70 ms
71,276 KB
testcase_05 AC 65 ms
71,124 KB
testcase_06 AC 468 ms
228,332 KB
testcase_07 AC 444 ms
228,608 KB
testcase_08 AC 278 ms
157,272 KB
testcase_09 AC 1,039 ms
224,576 KB
testcase_10 AC 477 ms
127,780 KB
testcase_11 AC 76 ms
76,044 KB
testcase_12 AC 97 ms
77,128 KB
testcase_13 AC 110 ms
80,172 KB
testcase_14 AC 207 ms
102,148 KB
testcase_15 AC 147 ms
86,016 KB
testcase_16 AC 140 ms
84,160 KB
testcase_17 AC 110 ms
82,596 KB
testcase_18 AC 67 ms
71,436 KB
testcase_19 AC 66 ms
71,328 KB
testcase_20 AC 83 ms
76,832 KB
testcase_21 AC 97 ms
76,812 KB
testcase_22 AC 67 ms
71,412 KB
testcase_23 AC 70 ms
71,356 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 H>x+u>=0and W>y+t>=0and s<=C[x+u][y+t]<C[x][y]:a+=1;f=1;s=C[x][y];break
  if f:break
print(a)
0