QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#494303#5005. GeekflixAbclWA 0ms3808kbC++14988b2024-07-27 15:07:592024-07-27 15:07:59

Judging History

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

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

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
int n,m;
int a[415],b[415];
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+n],a[i]=a[i+n];
	for(int i=1;i<=n;i++)cin>>b[i+n],b[i]=b[i+n];
	for(int l=1;l<=n;l++){
	for(int r=1+n;r<=n+n;r++){
		priority_queue<node> q;
		for(int i=l;i<=r;i++){
			q.push({a[i],b[i]});
		}
		int k=m-(r-n-1)-(n+1-l)-min((r-n-1),(n+1-l));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: 3504kb

input:

3 10
10 10 10
5 3 1

output:

67

result:

ok single line: '67'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3808kb

input:

5 10
1 2 3 4 5
0 1 2 3 4

output:

17

result:

wrong answer 1st lines differ - expected: '16', found: '17'