結果

問題 No.168 ものさし
ユーザー tkmst201tkmst201
提出日時 2017-05-18 21:38:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 504 ms / 2,000 ms
コード長 1,235 bytes
コンパイル時間 1,422 ms
コンパイル使用メモリ 150,468 KB
実行使用メモリ 37,300 KB
最終ジャッジ日時 2023-08-25 21:05:32
合計ジャッジ時間 5,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
11,824 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 10 ms
4,384 KB
testcase_11 AC 81 ms
12,140 KB
testcase_12 AC 326 ms
36,880 KB
testcase_13 AC 496 ms
36,824 KB
testcase_14 AC 504 ms
36,680 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 6 ms
4,376 KB
testcase_18 AC 19 ms
5,376 KB
testcase_19 AC 459 ms
36,776 KB
testcase_20 AC 475 ms
37,300 KB
testcase_21 AC 487 ms
36,228 KB
testcase_22 AC 494 ms
36,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> P;
typedef pair<long double, int> pdi;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-3;

int n;
double x[1000], y[1000];
long double d[1000];

int main() {
	cin >> n;
	REP(i, n) scanf("%lf %lf", x + i, y + i);
	
	fill(d, d + n, 1ll<<60);
	
	priority_queue<pdi, vector<pdi>, greater<pdi> > pq;
	pq.push(pdi(0, 0));
	
	while (!pq.empty()) {
		long double now = pq.top().first;
		int cur = pq.top().second;
		
		pq.pop();
		
		if (!chmin(d[cur], now)) continue;
		
		REP(i, n) if (i != cur) {
			long double nd = hypot<long double>(y[i] - y[cur], x[i] - x[cur]);
			
			long double nextd = max(nd, d[cur]);
			
			pq.push(pdi(nextd, i));
		}
	}
	
	printf("%lld\n", (ll)ceil(d[n - 1] / 10) * 10);
	
	return 0;
}
0