https://www.luogu.org/blog/user23248/solution-p1199
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<iostream> #include<vector> #include<algorithm> #include<functional> using namespace std; int n,a[501][501],maxV; int main(){ cin>>n; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ cin>>a[i][j]; a[j][i]=a[i][j]; } } for(int i=1;i<=n;i++){ sort(a[i]+1,a[i]+n+1); maxV=max(maxV,a[i][n-1]); } cout<<1<<endl<<maxV; } |