QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#315830#836. Farm of Monstershy233WA 11ms7668kbC++14726b2024-01-27 16:01:322024-01-27 16:01:33

Judging History

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

  • [2024-01-27 16:01:33]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:7668kb
  • [2024-01-27 16:01:32]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1000005;
inline int rd()
{
	int x=0; bool f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())
		if(ch=='-') f=0;
	for(;ch>='0'&&ch<='9';ch=getchar())
		x=x*10+(ch^48);
	return f?x:-x;
}
int h[N],c[N],d[N];
int main()
{
	int n=rd(),a=rd(),b=rd(); 
	for(int i=1;i<=n;i++)
		h[i]=rd();
	for(int i=1;i<=n;i++)
	{
		c[i]=((h[i]-1)%b+1+a-1)/a;
		d[i]=(h[i]+b-1)/b;
//		cout<<h[i]<<' '<<c[i]<<' '<<d[i]<<endl;
	}
	int res=0,ans=0;
	priority_queue<int> q;
	for(int i=1;i<=n;i++)
	{
		res+=d[i]-c[i]-1;
		q.push(c[i]+1);
		ans++;
		if(res<-1)
			ans--,res+=q.top(),q.pop();	
	}
	printf("%d\n",ans);
	return 0;
}

详细

Test #1:

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

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

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

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

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

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: 11ms
memory: 7668kb

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'