1 条题解

  • 1
    @ 2026-9-27 15:29:01
    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n,m;
    	if(!(cin>>n>>m)) return 0;
    	long long max_c=LLONG_MIN;
    	for(int i=0;i<n;++i){
    		long long c;
    		cin>>c;
    		if(c>max_c){
    			max_c=c;
    		}
    	}
    	for(int i=0;i<m;++i){
    		long long a;
    		cin>>a;
    		if(a>0){
    		max_c+=a;
    		}else{
    			if(n==1){
    			max_c+=a;
    			}
    		}
    	}
    	cout<<max_c;
    	return 0;
    }
    //包AC!!!
    

    信息

    ID
    3465
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    43
    已通过
    11
    上传者