結果

問題 No.2179 Planet Traveler
ユーザー 沙耶花沙耶花
提出日時 2023-01-06 21:56:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 965 bytes
コンパイル時間 4,863 ms
コンパイル使用メモリ 261,528 KB
実行使用メモリ 8,184 KB
最終ジャッジ日時 2023-08-20 15:03:56
合計ジャッジ時間 13,647 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 528 ms
8,056 KB
testcase_12 AC 520 ms
8,060 KB
testcase_13 WA -
testcase_14 AC 522 ms
8,128 KB
testcase_15 AC 512 ms
8,104 KB
testcase_16 AC 518 ms
8,172 KB
testcase_17 AC 517 ms
8,108 KB
testcase_18 AC 513 ms
8,172 KB
testcase_19 AC 528 ms
8,168 KB
testcase_20 AC 27 ms
4,404 KB
testcase_21 AC 469 ms
7,752 KB
testcase_22 AC 248 ms
6,264 KB
testcase_23 AC 206 ms
5,648 KB
testcase_24 AC 379 ms
6,964 KB
testcase_25 AC 270 ms
6,404 KB
testcase_26 AC 438 ms
7,544 KB
testcase_27 AC 29 ms
4,376 KB
testcase_28 AC 150 ms
5,152 KB
testcase_29 AC 381 ms
6,960 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] = ceil(pow(abs(sqrt(X)-sqrt(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