結果
| 問題 |
No.866 レベルKの正方形
|
| コンテスト | |
| ユーザー |
tko919
|
| 提出日時 | 2020-12-22 00:32:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,209 ms / 6,000 ms |
| コード長 | 948 bytes |
| コンパイル時間 | 1,839 ms |
| コンパイル使用メモリ | 170,172 KB |
| 実行使用メモリ | 431,744 KB |
| 最終ジャッジ日時 | 2024-09-21 13:32:20 |
| 合計ジャッジ時間 | 30,178 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end
char s[2010][2010];
int dp[2010][2010][27];
int main(){
int h,w,k; cin>>h>>w>>k;
rep(i,0,h)cin>>s[i];
for(int i=h;i>=0;i--)for(int j=w;j>=0;j--){
rep(c,0,27){
dp[i][j][c]=min({min(h-i,w-j)+1,dp[i][j+1][c],
dp[i+1][j][c],dp[i+1][j+1][c]})+1;
}
if(islower(s[i][j]))dp[i][j][s[i][j]-'a']=1;
}
ll res=0;
rep(i,0,h)rep(j,0,w){
sort(dp[i][j],dp[i][j]+27);
res+=dp[i][j][k]-dp[i][j][k-1];
}
cout<<res<<endl;
return 0;
}
tko919