QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314068#836. Farm of MonstersJWRuixiWA 14ms7632kbC++17853b2024-01-25 11:52:552024-01-25 11:52:56

Judging History

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

  • [2024-01-25 11:52:56]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:7632kb
  • [2024-01-25 11:52:55]
  • 提交

answer

#include <bits/stdc++.h>
#define IL inline
#define LL long long
#define eb emplace_back
#define L(i, j, k) for (int i = (j); i <= (k); ++i)
#define R(i, j, k) for (int i = (j); i >= (k); --i)
using namespace std;

using vi = vector<int>;
using cint = const int;

using pii = pair<int, int>;
#define fi first
#define se second

constexpr int N = 3e5 + 9;
int n, a, b, h[N], c[N], d[N];

int main () {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> a >> b;
	L (i, 1, n) cin >> h[i];
	L (i, 1, n) {
		int r = (h[i] - 1) % b + 1;
		c[i] = (r + a - 1) / a;
		d[i] = (h[i] + b - 1) / b;
	}
	priority_queue<int> q;
	int x = 0, y = 1;
	L (i, 1, n) {
		q.emplace(c[i] + 1);
		y += d[i] - c[i] - 1;
		if (y < 0) {
			y += q.top();
			q.pop();
		} else {
			++x;
		}
	}
	cout << x << '\n';
}
// I love WHQ!

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3764kb

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

10 34 100
17 27 73 17 60 12 25 53 31 46

output:

5

result:

ok answer is '5'

Test #4:

score: -100
Wrong Answer
time: 14ms
memory: 7632kb

input:

300000 1 1
336470888 634074578 642802746 740396295 773386884 579721198 396628655 503722503 971207868 202647942 2087506 268792718 46761498 443917727 16843338 125908043 691952768 717268783 787375312 150414369 693319712 519096230 45277106 856168102 762263554 674936674 407246545 274667941 279198849 5272...

output:

150098

result:

wrong answer expected '300000', found '150098'