QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#317328#836. Farm of Monsterssumi007WA 1ms7924kbC++14748b2024-01-28 20:42:482024-01-28 20:42:49

Judging History

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

  • [2024-01-28 20:42:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7924kb
  • [2024-01-28 20:42:48]
  • 提交

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),cout << x[i] << ' ' << h[i] << '\n';
	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;
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7924kb

input:

3 1 1
1 1 1

output:

-1 0
-1 0
-1 0
2

result:

wrong answer expected '2', found '-1'