Submission #949671


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef ld Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

void dijkstra(Graph &g, int s, Array &d)
{
	d.assign(g.size(), INF);
	d[s] = 0;
	typedef pair<Weight, int> P;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size())
		{
			Edge e = g[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}


int n;
vector<ld> x, y, t, r;

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	cin >> n;
	x.resize(n); y.resize(n); t.resize(n); r.resize(n);
	REP(i, n) cin >> x[i] >> y[i] >> t[i] >> r[i];
	Graph g(n);
	REP(i, n)REP(j, n)
	{
		if (i == j) continue;
		ld v = min(t[i], r[j]);
		ld dist = sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
		add_edge(g, i, j, dist / v);
	}
	Array d;
	dijkstra(g, 0, d);
	sort(ALL(d));
	REP(i, n - 1) d[n - i - 1] += (ld)i;
	cout << *max_element(ALL(d)) << endl;
	return 0;
}

Submission Info

Submission Time
Task C - THE☆たこ焼き祭り2012
User amano
Language C++11 (GCC 4.8.1)
Score 100
Code Size 2103 Byte
Status AC
Exec Time 90 ms
Memory 33572 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 46
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_min.txt AC 19 ms 804 KB
00_sample_01.txt AC 18 ms 928 KB
00_sample_02.txt AC 19 ms 804 KB
00_sample_03.txt AC 19 ms 804 KB
00_sample_04.txt AC 18 ms 800 KB
00_sample_05.txt AC 18 ms 804 KB
01_rand_00.txt AC 23 ms 2724 KB
01_rand_01.txt AC 31 ms 7544 KB
01_rand_02.txt AC 57 ms 20100 KB
01_rand_03.txt AC 24 ms 2932 KB
01_rand_04.txt AC 26 ms 5352 KB
01_rand_05.txt AC 20 ms 2596 KB
01_rand_06.txt AC 33 ms 7076 KB
01_rand_07.txt AC 37 ms 8948 KB
01_rand_08.txt AC 18 ms 928 KB
01_rand_09.txt AC 54 ms 18552 KB
02_maxrand_00.txt AC 86 ms 33524 KB
02_maxrand_01.txt AC 88 ms 33564 KB
02_maxrand_02.txt AC 88 ms 33520 KB
02_maxrand_03.txt AC 86 ms 33296 KB
02_maxrand_04.txt AC 88 ms 33552 KB
02_maxrand_05.txt AC 85 ms 33272 KB
02_maxrand_06.txt AC 87 ms 33292 KB
02_maxrand_07.txt AC 87 ms 33520 KB
02_maxrand_08.txt AC 89 ms 33552 KB
02_maxrand_09.txt AC 90 ms 33524 KB
03_slow_00.txt AC 87 ms 33272 KB
03_slow_01.txt AC 89 ms 33540 KB
03_slow_02.txt AC 88 ms 33524 KB
03_slow_03.txt AC 84 ms 33292 KB
03_slow_04.txt AC 87 ms 33272 KB
03_slow_05.txt AC 86 ms 33272 KB
03_slow_06.txt AC 87 ms 33272 KB
03_slow_07.txt AC 86 ms 33272 KB
03_slow_08.txt AC 86 ms 33296 KB
03_slow_09.txt AC 88 ms 33272 KB
04_logspeed_00.txt AC 87 ms 33272 KB
04_logspeed_01.txt AC 87 ms 33572 KB
04_logspeed_02.txt AC 87 ms 33544 KB
04_logspeed_03.txt AC 89 ms 33524 KB
04_logspeed_04.txt AC 87 ms 33568 KB
04_logspeed_05.txt AC 88 ms 33548 KB
04_logspeed_06.txt AC 86 ms 33520 KB
04_logspeed_07.txt AC 88 ms 33564 KB
04_logspeed_08.txt AC 89 ms 33524 KB
04_logspeed_09.txt AC 89 ms 33520 KB