提出 #46561


ソースコード 拡げる

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

double c[1001][1001];
double ans[1001];
int main() {

	int N;
	cin>>N;

	if(N==1){
		cout<<0<<endl;
		return 0;
	}
	vector <int> uv;
	vector <int> x,y,r,t;
	for(int i=0;i<N;++i){
		int tmpx,tmpy;
		cin>>tmpx>>tmpy;
		x.push_back(tmpx);
		y.push_back(tmpy);
		cin>>tmpx>>tmpy;
		t.push_back(tmpx);
		r.push_back(tmpy);
		if(i!=0)uv.push_back(i);
	}

	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			c[i][j]= sqrt(abs(x[i]-x[j])*abs(x[i]-x[j])
				+ abs(y[i]-y[j])*abs(y[i]-y[j]))/(double)min(t[i],r[j]);
		}
			ans[i]=-1;
	}


	vector <int> v;
	v.push_back(0);
	ans[0]=0;
	while(1){
		double neigh=1000000;
		int from=0,to=0;
		for(int i=0;i<v.size();++i){
			for(int j=0;j<uv.size();++j){
				if(ans[v[i]]>=0&&neigh> ans[v[i]]+c[v[i]][uv[j]]){
					neigh=ans[v[i]]+c[v[i]][uv[j]];
					from=i;
					to=uv[j];
				}
			}
		}
		ans[to]=neigh;
		v.push_back(to);
		uv.erase(remove(uv.begin(),uv.end(),to),uv.end());
		if(uv.size()==0)break;
	}

	double result=0;
	vector <double> res;
	for(int i=0;i<N;++i){
		res.push_back(ans[i]);
	}
	sort(res.begin(),res.end());


	for(int i=0;i<N-1;++i){
		result=(res[N-i-1]+(double)i>result)?res[N-i-1]+(double)i:result;
	}
cout<<setprecision(10);	cout<<result<<endl;
}

提出情報

提出日時
問題 C - THE☆たこ焼き祭り2012
ユーザ kaiy
言語 C++ (G++ 4.6.4)
得点 100
コード長 1742 Byte
結果 AC
実行時間 1038 ms
メモリ 8576 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 46
セット名 テストケース
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 02_maxrand_00.txt, 02_maxrand_01.txt, 02_maxrand_02.txt, 02_maxrand_03.txt, 02_maxrand_04.txt, 02_maxrand_05.txt, 02_maxrand_06.txt, 02_maxrand_07.txt, 02_maxrand_08.txt, 02_maxrand_09.txt, 03_slow_00.txt, 03_slow_01.txt, 03_slow_02.txt, 03_slow_03.txt, 03_slow_04.txt, 03_slow_05.txt, 03_slow_06.txt, 03_slow_07.txt, 03_slow_08.txt, 03_slow_09.txt, 04_logspeed_00.txt, 04_logspeed_01.txt, 04_logspeed_02.txt, 04_logspeed_03.txt, 04_logspeed_04.txt, 04_logspeed_05.txt, 04_logspeed_06.txt, 04_logspeed_07.txt, 04_logspeed_08.txt, 04_logspeed_09.txt
ケース名 結果 実行時間 メモリ
00_min.txt AC 23 ms 732 KiB
00_sample_01.txt AC 24 ms 788 KiB
00_sample_02.txt AC 22 ms 788 KiB
00_sample_03.txt AC 23 ms 796 KiB
00_sample_04.txt AC 23 ms 820 KiB
00_sample_05.txt AC 21 ms 784 KiB
01_rand_00.txt AC 31 ms 1944 KiB
01_rand_01.txt AC 71 ms 3700 KiB
01_rand_02.txt AC 316 ms 6396 KiB
01_rand_03.txt AC 37 ms 2320 KiB
01_rand_04.txt AC 45 ms 2812 KiB
01_rand_05.txt AC 31 ms 1948 KiB
01_rand_06.txt AC 62 ms 3316 KiB
01_rand_07.txt AC 104 ms 4608 KiB
01_rand_08.txt AC 22 ms 1044 KiB
01_rand_09.txt AC 263 ms 6128 KiB
02_maxrand_00.txt AC 907 ms 8564 KiB
02_maxrand_01.txt AC 887 ms 8564 KiB
02_maxrand_02.txt AC 1015 ms 8560 KiB
02_maxrand_03.txt AC 936 ms 8568 KiB
02_maxrand_04.txt AC 889 ms 8568 KiB
02_maxrand_05.txt AC 1026 ms 8568 KiB
02_maxrand_06.txt AC 911 ms 8568 KiB
02_maxrand_07.txt AC 919 ms 8576 KiB
02_maxrand_08.txt AC 884 ms 8576 KiB
02_maxrand_09.txt AC 1009 ms 8568 KiB
03_slow_00.txt AC 943 ms 8576 KiB
03_slow_01.txt AC 966 ms 8572 KiB
03_slow_02.txt AC 915 ms 8560 KiB
03_slow_03.txt AC 1034 ms 8560 KiB
03_slow_04.txt AC 1007 ms 8572 KiB
03_slow_05.txt AC 869 ms 8560 KiB
03_slow_06.txt AC 1038 ms 8572 KiB
03_slow_07.txt AC 970 ms 8568 KiB
03_slow_08.txt AC 880 ms 8572 KiB
03_slow_09.txt AC 941 ms 8568 KiB
04_logspeed_00.txt AC 986 ms 8568 KiB
04_logspeed_01.txt AC 1006 ms 8568 KiB
04_logspeed_02.txt AC 1009 ms 8568 KiB
04_logspeed_03.txt AC 982 ms 8576 KiB
04_logspeed_04.txt AC 882 ms 8572 KiB
04_logspeed_05.txt AC 1004 ms 8568 KiB
04_logspeed_06.txt AC 1014 ms 8564 KiB
04_logspeed_07.txt AC 983 ms 8572 KiB
04_logspeed_08.txt AC 969 ms 8572 KiB
04_logspeed_09.txt AC 1029 ms 8568 KiB