結果
問題 |
No.866 レベルKの正方形
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:14:26 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 981 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,496 KB |
実行使用メモリ | 89,592 KB |
最終ジャッジ日時 | 2025-06-12 21:15:57 |
合計ジャッジ時間 | 8,729 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 8 TLE * 1 -- * 13 |
ソースコード
H, W, K = map(int, input().split()) grid = [input().strip() for _ in range(H)] count = 0 for a in range(H): for b in range(W): charset = set() max_s = min(H - a, W - b) for s in range(1, max_s + 1): # Add new row (a + s - 1) from column b to b + s - 1 new_row = a + s - 1 for j in range(b, b + s): c = grid[new_row][j] if c not in charset: charset.add(c) # Add new column (b + s - 1) from row a to a + s - 2 (excluding the last cell) new_col = b + s - 1 for i in range(a, a + s - 1): c = grid[i][new_col] if c not in charset: charset.add(c) # Check current count current = len(charset) if current == K: count += 1 elif current > K: break # Further expansion won't reduce the count print(count)