結果
| 問題 |
No.2179 Planet Traveler
|
| コンテスト | |
| ユーザー |
_yurimoir
|
| 提出日時 | 2023-01-07 09:02:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,547 bytes |
| コンパイル時間 | 3,025 ms |
| コンパイル使用メモリ | 253,352 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-12-14 08:26:57 |
| 合計ジャッジ時間 | 52,010 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 12 WA * 3 TLE * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
int n;
cin>>n;
vector<int> x(n),y(n),t(n);
for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>t[i];
int high,low;
high=1e9;low=0;
while(high-low>1){
int mid=(high+low)/2;
queue<int> que;
que.push(0);
vector<int> dist(n,1e9);
dist[0]=0;
while(!que.empty()){
int px=que.front();
que.pop();
for(int i=0;i<n;i++){
double d;
if(t[px]!=t[i]){
int a,b;
a=x[i ]*x[i ]+y[i ]*y[i ];
b=x[px]*x[px]+y[px]*y[px];
double hq,lq;
hq=1e9;lq=0;
while(hq-lq>0.00001){
double mq=(hq+lq)/2.0;
if(mq*mq>(double)4.0*a*b){
hq=mq;
}else{
lq=mq;
}
}
d=(double)a+b-lq;
}else{
d=(x[i ]-x[px])*(x[i ]-x[px])
+ (y[i ]-y[px])*(y[i ]-y[px]);
}
if(d<=mid
&& dist[i]>dist[px]+1
){
dist[i]=dist[px]+1;
que.push(i);
}
}
}
if(dist[n-1]==1e9){
low=mid;
}else{
high=mid;
}
}
cout<<high<<endl;
return 0;
}
_yurimoir