QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#586910#5059. Plants vs ZombiesMilkcat2009WA 1ms7744kbC++141.7kb2024-09-24 16:29:592024-09-24 16:29:59

Judging History

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

  • [2024-09-24 16:29:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7744kb
  • [2024-09-24 16:29:59]
  • 提交

answer

#include <bits/stdc++.h>
#define REP(i, l, r) for (int i = (l); i <= (r); ++ i)
#define DEP(i, r, l) for (int i = (r); i >= (l); -- i)
#define fi first
#define se second
#define pb emplace_back
#define mems(x, v) memset((x), (v), sizeof(x))
using namespace std;
namespace Milkcat {
	typedef long long LL;
	typedef pair<LL, LL> pii;
	const int N = 1e6 + 5;
	struct zmb {
		LL t, id, h;
		bool operator < (const zmb& x) const { return (t == x.t ? id > x.id : t < x.t); }
	} a[N];
	LL n, m, v, k, d, pr[N], rs[N]; pii b[N];
	LL calc(LL x) {
		int t = upper_bound(b + 1, b + 1 + m, pii((x + 1) * v, 1e9)) - b - 1;
		return pr[t];
	} 
	int main() {
		cin >> n >> m >> v >> k >> d;
		REP(i, 1, n) cin >> a[i].t >> a[i].h, a[i].id = i;
		REP(i, 1, m) cin >> b[i].fi >> b[i].se;
		sort(a + 1, a + 1 + n);
		sort(b + 1, b + 1 + m);
		REP(i, 1, m) pr[i] = pr[i - 1] + b[i].se;
		LL t = 1, r = k;
		REP(i, 1, n) {
			LL x = 0, w = calc(t - a[i].t);
			if (a[i].t <= t && a[i].h <= w + r * d) {
				if (a[i].h <= w) {
					int p = lower_bound(pr + 1, pr + 1 + m, a[i].h) - pr;
					rs[a[i].id] = a[i].t + (b[i].fi + v - 1) / v - 1;
				} else {
					rs[a[i].id] = t;
					r -= max((a[i].h - w + d - 1) / d, 0LL);
				}
				continue;
			}
			a[i].h -= r * d;
			DEP(j, 30, 0) {
				LL y = x + (1 << j);
				if (calc(y + t - a[i].t) + d * k * y < a[i].h) x += 1 << j;
			}
			x ++, t += x, r = k - max((a[i].h - calc(x + t - a[i].t) - d * k * (x - 1) + d - 1) / d, 0LL);
			rs[a[i].id] = t;
		}
		REP(i, 1, n) cout << rs[i] << ' ';
		cout << '\n';
		return 0;
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int T = 1;
	while (T --) Milkcat::main();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 7712kb

input:

3 2 1 2 2
1 11
2 8
1 1
1 2
2 4

output:

2 3 1 

result:

ok 3 number(s): "2 3 1"

Test #2:

score: 0
Accepted
time: 1ms
memory: 7744kb

input:

1 1 1 1 1
1 1
1 1

output:

1 

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 7676kb

input:

3 3 1 1 2
4 4
1 10
2 4
4 1
4 2
4 1

output:

6 4 5 

result:

ok 3 number(s): "6 4 5"

Test #4:

score: 0
Accepted
time: 1ms
memory: 7652kb

input:

3 3 3 1 3
2 2
1 10
3 6
1 1
5 2
5 1

output:

3 2 4 

result:

ok 3 number(s): "3 2 4"

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 7724kb

input:

100 100 1 699 1
695 44646
675 24436
962 82902
293 78650
759 58744
487 49515
768 60962
380 83162
9 92232
502 39702
170 1920
653 66006
595 94263
953 4538
976 49244
39 31995
480 99939
638 92034
926 25555
125 62420
788 96382
917 60564
41 77628
699 61083
145 99923
386 47153
209 82540
477 92571
324 11390
...

output:

5126 4898 7120 2202 5499 3826 5820 2999 173 3882 1328 4769 4417 7002 7227 346 3756 4675 6784 973 5960 6632 456 5212 1197 3066 1668 3614 2584 5734 770 5063 4426 4283 6996 4167 1766 1327 2015 2438 6145 4864 6354 2018 41 5267 3407 3406 5007 2711 3344 5332 4004 548 611 1646 1055 1550 680 1455 6532 4544 ...

result:

wrong answer 1st numbers differ - expected: '5134', found: '5126'