結果
| 問題 | No.134 走れ!サブロー君 |
| コンテスト | |
| ユーザー |
nxteru
|
| 提出日時 | 2018-06-30 13:36:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 830 bytes |
| 記録 | |
| コンパイル時間 | 683 ms |
| コンパイル使用メモリ | 78,824 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 00:54:15 |
| 合計ジャッジ時間 | 1,312 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 10 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define F first
#define S second
double x[15],y[15],w[15],dp[15][1<<15],s;
int n;
int main(void){
cin>>x[0]>>y[0]>>n;
n++;
for(int i=1;i<n;i++)cin>>x[i]>>y[i]>>w[i];
for(int i=0;i<n;i++)for(int j=0;j<1<<n;j++)dp[i][j]=500000;
dp[0][0]=0;
for(int k=0;k<1<<n;k++){
s=0;
for(int i=1;i<n;i++)if(!(k>>i&1))s+=w[i];
for(int p=0;p<n;p++){
for(int i=0;i<n;i++){
if(!(k>>i&1)){
dp[i][k|1<<i]=min(dp[i][k|1<<i],dp[p][k]+(abs(x[p]-x[i])+abs(y[p]-y[i]))*(s+100)/120+w[i]);
}
}
}
}
cout<<dp[0][(1<<n)-1]<<endl;
}
nxteru