Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
147845 | 梁乃元 | 对抗赛 | C++ | 通过 | 100 | 127 MS | 260 KB | 561 | 2024-05-19 21:16:26 |
# include <bits/stdc++.h> using namespace std ; int a [114514] , n , maxs ; void dfs ( int cur , int t1 , int t2 , int c1 , int c2 ) { if ( cur > n ) { maxs = max ( maxs , min ( t1 , t2 ) ) ; return ; } if ( c1 < n / 2 ) { dfs ( cur + 1 , t1 + a [cur] , t2 , c1 + 1 , c2 ) ; } if ( c2 < n / 2 ) { dfs ( cur + 1 , t1 , t2 + a [cur] , c1 , c2 + 1 ) ; } return ; } int main ( ) { cin >> n ; for ( int i = 1 ; i <= n ; i ++ ) { cin >> a [i] ; } dfs ( 1 , 0 , 0 , 0 , 0 ) ; cout << maxs << endl ; return 0 ; }