結果

問題 No.1668 Grayscale
ユーザー harurunharurun
提出日時 2021-09-03 22:56:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,145 ms / 4,000 ms
コード長 368 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 226,840 KB
最終ジャッジ日時 2024-05-09 06:12:42
合計ジャッジ時間 5,990 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,352 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 36 ms
51,840 KB
testcase_04 AC 35 ms
51,968 KB
testcase_05 AC 34 ms
51,968 KB
testcase_06 AC 489 ms
226,528 KB
testcase_07 AC 442 ms
226,840 KB
testcase_08 AC 271 ms
152,744 KB
testcase_09 AC 1,145 ms
222,720 KB
testcase_10 AC 587 ms
127,084 KB
testcase_11 AC 44 ms
60,288 KB
testcase_12 AC 69 ms
71,168 KB
testcase_13 AC 93 ms
80,512 KB
testcase_14 AC 217 ms
102,528 KB
testcase_15 AC 137 ms
86,224 KB
testcase_16 AC 127 ms
82,756 KB
testcase_17 AC 86 ms
81,656 KB
testcase_18 AC 36 ms
51,968 KB
testcase_19 AC 36 ms
51,712 KB
testcase_20 AC 63 ms
64,640 KB
testcase_21 AC 66 ms
69,888 KB
testcase_22 AC 37 ms
52,224 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