Luogu P1199 [NOIP2010 Popularity Group] Three Kingdoms Game (greedy

P1199

The first optimal combination cannot be obtained, but the second optimal combination cannot be obtained. The computer cannot obtain the optimal (one of which was obtained by me)

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
int main(){
    
    
	int n,num[509][509]={
    
    };
	cin>>n;
	for(int i=1;i<=n-1;i++){
    
    
		for(int j=i+1;j<=n;j++){
    
    
			cin>>num[i][j];
			num[j][i]=num[i][j];
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
    
    
		sort(num[i]+1,num[i]+1+n);
		ans=max(ans,num[i][n-1]);
	}cout<<"1\n"<<ans;
	
	return 0;
	
}

Guess you like

Origin blog.csdn.net/Minelois/article/details/114106408