QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#317329#836. Farm of Monsterssumi007WA 20ms10092kbC++14712b2024-01-28 20:43:032024-01-28 20:43:05

Judging History

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

  • [2024-01-28 20:43:05]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:10092kb
  • [2024-01-28 20:43:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ldb long double
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(i) i&(-i)
const int N = 6e5+6;
int n,a,b,h[N],r[N],x[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++) cin >> h[i],h[i]--;
	for(int i=1;i<=n;i++) r[i] = h[i]%b,r[i] /= a;
	for(int i=1;i<=n;i++) x[i] = (h[i]-r[i]*a)/b-(r[i]+1);
	priority_queue<int> q;
	int sum = 1;
	for(int i=1;i<=n;i++){
		q.push((h[i]/b)+1-x[i]),sum += x[i];
		if(sum<0) sum += q.top(),q.pop();
	}
	int ans = q.size();
	cout << ans;
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

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

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

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

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: 20ms
memory: 10092kb

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'