結果

問題 No.2179 Planet Traveler
ユーザー 沙耶花沙耶花
提出日時 2023-01-06 21:58:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 529 ms / 3,000 ms
コード長 969 bytes
コンパイル時間 4,636 ms
コンパイル使用メモリ 262,064 KB
実行使用メモリ 8,348 KB
最終ジャッジ日時 2023-08-20 15:05:26
合計ジャッジ時間 13,079 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 467 ms
8,128 KB
testcase_12 AC 525 ms
8,196 KB
testcase_13 AC 525 ms
8,052 KB
testcase_14 AC 461 ms
8,180 KB
testcase_15 AC 464 ms
8,348 KB
testcase_16 AC 464 ms
8,104 KB
testcase_17 AC 529 ms
8,092 KB
testcase_18 AC 525 ms
8,188 KB
testcase_19 AC 522 ms
8,136 KB
testcase_20 AC 31 ms
4,376 KB
testcase_21 AC 471 ms
7,788 KB
testcase_22 AC 259 ms
6,208 KB
testcase_23 AC 222 ms
5,808 KB
testcase_24 AC 387 ms
7,044 KB
testcase_25 AC 278 ms
6,384 KB
testcase_26 AC 440 ms
7,852 KB
testcase_27 AC 33 ms
4,376 KB
testcase_28 AC 159 ms
5,200 KB
testcase_29 AC 389 ms
7,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 2000000000000000005



int main(){
	
	int n;
	cin>>n;
	
	vector<long long> x(n),y(n),t(n);
	rep(i,n){
		cin>>x[i]>>y[i]>>t[i];
		/*
		x[i] = 100;
		y[i] = i;
		t[i] = i+1;
		*/
	}
	
	vector d(n,vector<long long>(n,Inf64));
	rep(i,n)d[i][i] = 0;
	
	rep(i,n){
		rep(j,n){
			if(i==j)continue;
			if(t[i]==t[j]){
				d[i][j] = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
			}
			else{
				long long X = x[i]*x[i] + y[i]*y[i];
				long long Y = x[j]*x[j] + y[j]*y[j];
				
				d[i][j] = ceill(powl(abs(sqrtl(X)-sqrtl(Y)),2.0));//abs(X-Y)*abs(X-Y);
				//cout<<i<<','<<j<<','<<d[i][j]<<endl;
			}
		}
	}
	
	rep(i,n){
		rep(j,n){
			rep(k,n){
				d[j][k] = min(d[j][k],max(d[j][i],d[i][k]));
			}
		}
	}
	
	cout<<d[0][n-1]<<endl;
	
    return 0;
}
0