結果
| 問題 | No.866 レベルKの正方形 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-23 19:34:04 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 828 bytes |
| 記録 | |
| コンパイル時間 | 362 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2026-08-23 19:34:38 |
| 合計ジャッジ時間 | 10,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 8 TLE * 1 -- * 13 |
ソースコード
#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
const int N = 2010;
char ch[N][N];
int h, w, k, ans;
int main() {
scanf("%d%d%d", &h, &w, &k);
for (int i = 1; i <= h; ++i) {
string s;
cin >> s;
for (int j = 1; j <= w; ++j) {
ch[i][j] = s[j - 1];
}
}
for (int len = 1; len <= min(h, w); ++len) {
for (int x1 = 1; x1 <= h - len; ++x1) {
for (int y1 = 1; y1 <= w - len; ++y1) {
set<char> s;
for (int i = x1; i <= x1 + len; ++i) {
for (int j = y1; j <= y1 + len; ++j) {
s.insert(ch[i][j]);
}
}
if (s.size() == k) ++ans;
}
}
}
printf("%d\n", ans);
return 0;
}