1 条题解
-
3
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; int n; int a[510][510]; bool used[510]; int main() { scanf( "%d", &n ); for( int i = 1; i <= n; ++i ) for( int j = i+1; j <= n; ++j ) { scanf( "%d", &a[i][j] ); a[j][i] = a[i][j]; } int ans = -1; for( int i = 1; i <= n; ++i ) { int m1 = -1, m2 = -1; for( int j = 1; j <= n; ++j ) if( i != j ) { if( a[i][j] > m1 ) { m2 = m1; m1 = a[i][j]; } else if( a[i][j] > m2 ) m2 = a[i][j]; } ans = max( ans, m2 ); } printf( "1\n%d\n", ans ); return 0; }
AC
- 1
信息
- ID
- 1573
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- 递交数
- 23
- 已通过
- 19
- 上传者