結果

問題 No.2157 崖
ユーザー tailstails
提出日時 2022-12-09 22:16:10
言語 cLay
(20240104-1)
結果
AC  
実行時間 443 ms / 6,000 ms
コード長 352 bytes
コンパイル時間 6,536 ms
コンパイル使用メモリ 213,616 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-22 22:23:10
合計ジャッジ時間 11,362 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 274 ms
9,856 KB
testcase_14 AC 170 ms
11,904 KB
testcase_15 AC 419 ms
9,600 KB
testcase_16 AC 443 ms
9,728 KB
testcase_17 AC 135 ms
10,752 KB
testcase_18 AC 137 ms
10,752 KB
testcase_19 AC 407 ms
10,880 KB
testcase_20 AC 194 ms
12,544 KB
testcase_21 AC 190 ms
12,544 KB
testcase_22 AC 137 ms
10,496 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int@n,@m,@d[n][m];
sortA(m,d[0..n-1]);
int l=-1,h=1d9+1,k;
while(l+1<h){
	k=l+h>>1;
	VI u(m,1);
	rep(y,1,n){
		VI v(m);
		int w=0;
		rep(x,m){
			if(u[x]){
				while(w<m&&d[y][w]<d[y-1][x]){
					++w;
				}
				while(w<m&&d[y][w]-d[y-1][x]<=k){
					v[w]=1;
					++w;
				}
			}
		}
		u=v;
	}
	if(max(u(m))){
		h=k;
	}else{
		l=k;
	}
}
wt(h>1d9?-1:h);
0