QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#314718 | #836. Farm of Monsters | peter | WA | 16ms | 6268kb | C++14 | 703b | 2024-01-26 08:18:37 | 2024-01-26 08:18:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=3e5+5;
int a[maxn],b[maxn],c[maxn];
struct node{
int x,y;
node(){}
node(int xx,int yy){
x=xx;
y=yy;
}
bool operator < (const node &p) const {
if(x==p.x) return y>p.y;
return x<p.x;
}
};
priority_queue<int> que;
int main(){
int n,A,B;
scanf("%d %d %d",&n,&A,&B);
for(int i=1;i<=n;i++){
int x;
scanf("%d",&x);
a[i]=((x-1)%B+A)/A;
b[i]=(x+B-1)/B;
}
int sum=0;
for(int i=1;i<=n;i++){
que.push(a[i]+1);
sum+=(b[i]-a[i]-1);
while(sum<-1&&(!que.empty())){
int x=que.top();
sum+=x;
que.pop();
}
}
printf("%d\n",(int)que.size());
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3796kb
input:
3 1 1 1 1 1
output:
2
result:
ok answer is '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
3 1 1 2 2 2
output:
3
result:
ok answer is '3'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3936kb
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: 16ms
memory: 6268kb
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:
2
result:
wrong answer expected '300000', found '2'