QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#494284#5005. GeekflixAbclWA 0ms3724kbC++14897b2024-07-27 15:01:502024-07-27 15:01:50

Judging History

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

  • [2024-07-27 15:01:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3724kb
  • [2024-07-27 15:01:50]
  • 提交

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;
}


Details

Tip: Click on the bar to expand more detailed information

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'