QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322881#836. Farm of MonsterscomplexorWA 14ms7720kbC++23980b2024-02-07 21:47:242024-02-07 21:47:25

Judging History

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

  • [2024-02-07 21:47:25]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:7720kb
  • [2024-02-07 21:47:24]
  • 提交

answer

#include <bits/stdc++.h>
#define clr(f, n) memset(f, 0, (n) << 2)
#define cpy(f, g, n) memcpy(f, g, (n) << 2)
typedef long long LL;
typedef unsigned long long ULL;
typedef __int128 LLL;
typedef std::pair<int, int> pii;
#define MP std::make_pair
#define fi first
#define se second
int read()
{
	int s = 0, f = 1;
	char c = getchar();
	while (!(c >= '0' && c <= '9'))
		f ^= (c == '-'), c = getchar();
	while (c >= '0' && c <= '9')
		s = s * 10 + (c ^ 48), c = getchar();
	return f ? s : -s;
}
const int MAXN = 300005;
int n, h[MAXN], A, B;
int a[MAXN], b[MAXN];
std::priority_queue<int> q;
int main()
{
	n = read(), A = read(), B = read();
	for (int i = 1; i <= n; i++) h[i] = read() - 1;
	for (int i = 1; i <= n; i++) 
		a[i] = (h[i] % B) / A + 1, b[i] = h[i] / B + 1;
	int sum = 1;
	for (int i = 1; i <= n; i++)
	{
		sum += b[i] - a[i] - 1, q.push(a[i] + 1);
		if (sum < 0) sum += q.top(), q.pop();
	}
	printf("%d\n", q.size());
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

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

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

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

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: 7720kb

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'