結果
| 問題 | 
                            No.1668 Grayscale
                             | 
                    
| コンテスト | |
| ユーザー | 
                             riano
                         | 
                    
| 提出日時 | 2021-08-31 00:47:29 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 675 bytes | 
| コンパイル時間 | 426 ms | 
| コンパイル使用メモリ | 82,384 KB | 
| 実行使用メモリ | 367,472 KB | 
| 最終ジャッジ日時 | 2024-12-15 09:00:38 | 
| 合計ジャッジ時間 | 17,605 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 20 TLE * 2 | 
ソースコード
import sys
input = sys.stdin.readline
H,W,N = map(int, input().split())
ans = 1
c = []
for i in range(H):
    lis = list(map(int, input().split()))
    c.append(lis)
ran = []
for i in range(H):
    for j in range(W-1):
        a = c[i][j]
        b = c[i][j+1]
        if(a!=b):
            if(a<b):
                a,b = b,a
            r = [a,b]
            ran.append(r)
for i in range(H-1):
    for j in range(W):
        a = c[i][j]
        b = c[i+1][j]
        if(a!=b):
            if(a<b):
                a,b = b,a
            r = [a,b]
            ran.append(r)
ran.sort()
mx = 0
for r in ran:
    if(r[1]>=mx):
        mx = r[0]
        ans += 1
print(ans)
            
            
            
        
            
riano