QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#317328 | #836. Farm of Monsters | sumi007 | WA | 1ms | 7924kb | C++14 | 748b | 2024-01-28 20:42:48 | 2024-01-28 20:42:49 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'