// lanqiao 19713 拔河 #include using namespace std; #define int long long const int N = 1e3+10; int a[N], s[N]; // s为前缀和数组 multiset ms; signed main(){ int n; cin>>n; for(int i = 1; i<=n; i++){ cin >> a[i]; s[i] = s[i-1] + a[i]; } // 使用set数组去维护所有的区间和 for(int i = 1; i<=n; i++){ for(int j = i; j<=n; j++){ ms.insert(s[j] - s[i-1]); } } int ans = LLONG_MAX; // 时间复杂度为 O(n^log2n) for(int i = 1; i<=n; i++){ for(int j = 1; j 1 5 10 9 8 12 14 */