我样例全过,为何0分?
查看原帖
我样例全过,为何0分?
1309909
chenyingwang楼主2025/6/15 14:51
#include<bits/stdc++.h>
using namespace std;
int ans=1e9;
vector<int> a,b,p;
int main(){
	int n;
	cin>>n;
    a.resize(n);
    b.resize(n);
    p.resize(n);
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
    for(int i=1;i<=n;i++)p[i]=i;
	do{
		int len=n;
		for (int i=1;i<n;i++){
			len+=max(b[p[i]],a[p[i+1]]);
		}
		ans=min(ans,len);
	}while(next_permutation(p.begin(),p.end()));
	cout<<ans;
	return 0;
}

I've passed all the samples, why 0 points

2025/6/15 14:51
加载中...