結果

問題 No.866 レベルKの正方形
ユーザー kotatsugamekotatsugame
提出日時 2019-08-17 04:13:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 61,500 KB
実行使用メモリ 409,700 KB
最終ジャッジ日時 2023-10-24 23:39:02
合計ジャッジ時間 47,175 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2,297 ms
409,700 KB
testcase_09 AC 2,474 ms
409,700 KB
testcase_10 AC 3,017 ms
409,700 KB
testcase_11 AC 3,230 ms
409,700 KB
testcase_12 AC 3,759 ms
409,700 KB
testcase_13 AC 3,210 ms
409,700 KB
testcase_14 AC 3,905 ms
409,700 KB
testcase_15 AC 2,825 ms
409,700 KB
testcase_16 AC 3,528 ms
409,700 KB
testcase_17 AC 2,970 ms
409,700 KB
testcase_18 AC 3,265 ms
409,700 KB
testcase_19 AC 3,707 ms
409,700 KB
testcase_20 AC 3,038 ms
409,700 KB
testcase_21 WA -
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main()
      | ^~~~

ソースコード

diff #

#include<ios>
using namespace std;
int H,W,K;
int sum[2001][2001][26];
inline int f(int x,int y,int k)
{
	int L=1,R=(H-x<W-y?H-x:W-y)+1;
	while(R-L>1)
	{
		int M=L+R>>1;
		int cnt=k;
		for(int c=0;c<26;c++)
		{
			if(sum[x+M][y+M][c]-sum[x+M][y][c]-sum[x][y+M][c]+sum[x][y][c])cnt--;
		}
		if(cnt>0)L=M;
		else R=M;
	}
	return R;
}
main()
{
	scanf("%d%d%d",&H,&W,&K);
	for(int i=0;i<H;i++)
	{
		getchar_unlocked();
		for(int j=0;j<W;j++)
		{
			for(int c=0;c<26;c++)
			{
				sum[i+1][j+1][c]=sum[i+1][j][c]+sum[i][j+1][c]-sum[i][j][c];
			}
			sum[i+1][j+1][getchar_unlocked()-'a']++;
		}
	}
	long ans=0;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)
	{
	    ans+=f(i,j,K+1)-f(i,j,K);
	}
	printf("%ld\n",ans);
}
0