QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#494284 | #5005. Geekflix | Abcl | WA | 0ms | 3724kb | C++14 | 897b | 2024-07-27 15:01:50 | 2024-07-27 15:01:50 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
int n,m;
int a[205],b[205];
struct node{
int now,d;
bool operator<(const node& a)const {
return now<a.now;
}
};
void solve(){
cin>>n>>m;
int ans=0;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++)cin>>b[i];
for(int r=1;r<=n;r++){
priority_queue<node> q;
for(int i=1;i<=r;i++){
q.push({a[i],b[i]});
}
int k=m-(r-1);int sum=0;
for(int i=1;i<=k&&!q.empty();i++){
node p=q.top();q.pop();
if(p.now==0)break;
sum+=p.now;
p.now=max(0ll,p.now-p.d);
if(p.now)
q.push(p);
}
ans=max(ans,sum);
}
cout<<ans;
return;
}
signed main() {
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
3 10 10 10 10 5 3 1
output:
67
result:
ok single line: '67'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
5 10 1 2 3 4 5 0 1 2 3 4
output:
16
result:
ok single line: '16'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3724kb
input:
5 5 1 5000 1 1 5000 1 3000 1 1 3000
output:
7001
result:
wrong answer 1st lines differ - expected: '10000', found: '7001'