QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#292791#2427. Catch the PlaneAtomAlpacaAC ✓1082ms152196kbC++14964b2023-12-28 13:27:112023-12-28 13:27:11

Judging History

你现在查看的是最新测评结果

  • [2023-12-28 13:27:11]
  • 评测
  • 测评结果:AC
  • 用时:1082ms
  • 内存:152196kb
  • [2023-12-28 13:27:11]
  • 提交

answer

#include <bits/stdc++.h>

typedef long long ll;
typedef double db;

const int MAX = 1e6 + 5;

int n, m; ll k; db ans;
struct E
{
	int u, v; ll s, t; db p; int id;
	bool operator < (const E & x) const { return s == x.s ? id > x.id : s > x.s; }
} e[MAX];

std::map <ll, db> f[MAX];

int main()
{
	scanf("%d%d%lld", &m, &n, &k);
	for (int i = 1; i <= m; ++i)
	{
		scanf("%d%d%lld%lld%lf", &e[i].u, &e[i].v, &e[i].s, &e[i].t, &e[i].p); e[i].id = i;
	}
	std::sort(e + 1, e + m + 1);
	f[1][k + 1] = 1;
	for (int i = 1; i <= m; ++i)
	{
		int u = e[i].u, v = e[i].v; ll s = e[i].s, t = e[i].t; db p = e[i].p;
		auto iu = f[u].upper_bound(s), iv = f[v].upper_bound(t); db pu = 0, pv = 0;
		if (iu != f[u].end()) { pu = iu -> second; }
		if (iv != f[v].end()) { pv = iv -> second; }
		f[u][s] = std::max(f[u][s], std::max(pu, pu * (1.0 - p) + pv * p));
	}
	for (auto i : f[0]) { ans = std::max(ans, i.second); }
	printf("%.10lf", ans);
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 50708kb

Test #2:

score: 0
Accepted
time: 3ms
memory: 50572kb

Test #3:

score: 0
Accepted
time: 7ms
memory: 50464kb

Test #4:

score: 0
Accepted
time: 15ms
memory: 50496kb

Test #5:

score: 0
Accepted
time: 7ms
memory: 50572kb

Test #6:

score: 0
Accepted
time: 7ms
memory: 50628kb

Test #7:

score: 0
Accepted
time: 8ms
memory: 50520kb

Test #8:

score: 0
Accepted
time: 7ms
memory: 50460kb

Test #9:

score: 0
Accepted
time: 11ms
memory: 50636kb

Test #10:

score: 0
Accepted
time: 11ms
memory: 50632kb

Test #11:

score: 0
Accepted
time: 4ms
memory: 50696kb

Test #12:

score: 0
Accepted
time: 332ms
memory: 89692kb

Test #13:

score: 0
Accepted
time: 640ms
memory: 149760kb

Test #14:

score: 0
Accepted
time: 507ms
memory: 152076kb

Test #15:

score: 0
Accepted
time: 543ms
memory: 152148kb

Test #16:

score: 0
Accepted
time: 937ms
memory: 152120kb

Test #17:

score: 0
Accepted
time: 858ms
memory: 152188kb

Test #18:

score: 0
Accepted
time: 886ms
memory: 151992kb

Test #19:

score: 0
Accepted
time: 1082ms
memory: 152188kb

Test #20:

score: 0
Accepted
time: 3ms
memory: 50696kb

Test #21:

score: 0
Accepted
time: 7ms
memory: 50736kb

Test #22:

score: 0
Accepted
time: 504ms
memory: 120944kb

Test #23:

score: 0
Accepted
time: 568ms
memory: 152152kb

Test #24:

score: 0
Accepted
time: 964ms
memory: 152196kb

Test #25:

score: 0
Accepted
time: 945ms
memory: 152192kb