結果

問題 No.165 四角で囲え!
ユーザー tailstails
提出日時 2020-10-16 18:02:31
言語 cLay
(20240104-1)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 584 bytes
コンパイル時間 5,291 ms
コンパイル使用メモリ 217,512 KB
実行使用メモリ 5,664 KB
最終ジャッジ日時 2023-09-19 01:38:47
合計ジャッジ時間 7,754 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
5,460 KB
testcase_01 AC 2 ms
5,520 KB
testcase_02 AC 2 ms
5,460 KB
testcase_03 AC 2 ms
5,656 KB
testcase_04 AC 2 ms
5,584 KB
testcase_05 AC 82 ms
5,472 KB
testcase_06 AC 22 ms
5,664 KB
testcase_07 AC 2 ms
5,428 KB
testcase_08 AC 2 ms
5,504 KB
testcase_09 AC 2 ms
5,424 KB
testcase_10 AC 2 ms
5,648 KB
testcase_11 AC 33 ms
5,512 KB
testcase_12 AC 13 ms
5,512 KB
testcase_13 AC 13 ms
5,532 KB
testcase_14 AC 12 ms
5,532 KB
testcase_15 AC 10 ms
5,512 KB
testcase_16 AC 110 ms
5,524 KB
testcase_17 AC 70 ms
5,516 KB
testcase_18 AC 155 ms
5,440 KB
testcase_19 AC 88 ms
5,432 KB
testcase_20 AC 71 ms
5,512 KB
testcase_21 AC 71 ms
5,528 KB
testcase_22 AC 71 ms
5,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

struct{int c,p;}f[404][404];
int n,b,x[400],y[400],p[400],z;
{
	rd(n,b,(x,y,p)(n));
	int mx=coordcomp(n,x);
	int my=coordcomp(n,y);
	rep(i,n)f[y[i]+1][x[i]+1]={1,p[i]};
	rep(by,1,my+1){
		int kp=0,kc=0;
		rep(ix,1,mx+1){
			f[by][ix].p=(kp+=f[by][ix].p)+f[by-1][ix].p;
			f[by][ix].c=(kc+=f[by][ix].c)+f[by-1][ix].c;
		}
		rep(ay,by){
			int ax=0,bx=0,ap=0,bp=0;
			while(bx<=mx){
				if(bp-ap<=b){
					z>?=f[by][bx].c-f[by][ax].c-f[ay][bx].c+f[ay][ax].c;
					++bx;
					bp=f[by][bx].p-f[ay][bx].p;
				}else{
					++ax;
					ap=f[by][ax].p-f[ay][ax].p;
				}
			}
		}
	}
	wt(z);
}
0