結果

問題 No.2354 Poor Sight in Winter
ユーザー ゆにぽけゆにぽけ
提出日時 2023-11-18 17:00:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,049 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 127,632 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-18 17:01:12
合計ジャッジ時間 25,980 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,676 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 445 ms
6,676 KB
testcase_19 AC 1,415 ms
6,676 KB
testcase_20 AC 625 ms
6,676 KB
testcase_21 AC 11 ms
6,676 KB
testcase_22 AC 202 ms
6,676 KB
testcase_23 AC 220 ms
6,676 KB
testcase_24 AC 1,113 ms
6,676 KB
testcase_25 AC 111 ms
6,676 KB
testcase_26 AC 74 ms
6,676 KB
testcase_27 AC 3 ms
6,676 KB
testcase_28 AC 8 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cmath>
#include<ctime>
#include<iomanip>
#include<numeric>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<random>
#include<functional>
#include<utility>
using namespace std;
int N,K,x[502],y[502];
int dp[502][502];
void solve()
{
	cin >> N >> K;
	cin >> x[0] >> y[0] >> x[N+1] >> y[N+1];
	for(int i = 1;i <= N;i++) cin >> x[i] >> y[i];
	int ng = 0,ok = (int)2e5;
	while(ok-ng > 1)
	{
		int mid = (ok+ng)/2;
		for(int i = 0;i <= N+1;i++)for(int j = 0;j <= N+1;j++) 
		{
			int d = abs(x[i]-x[j]) + abs(y[i]-y[j]);
			dp[i][j] = (d-1)/mid;
		}
		for(int k = 0;k <= N+1;k++)for(int i = 0;i <= N+1;i++)for(int j = 0;j <= N+1;j++) dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);
		if(dp[0][N+1] <= K) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	/* cin >> tt; */
	while(tt--) solve();
}
0