贵州省建设项目备案查询网站,男科医院在线咨询免费,郑州网站改版公司,应用市场下载安装Problem - D - Codeforces
题意#xff1a; 思路#xff1a;
这道题需要倒着步骤考虑#xff0c;就是先去假设已经分为了两部分#xff0c;这左右两部分的和相等#xff0c;然后去想上一个步骤
倒着一个步骤后#xff0c;可以发现这样的性质#xff1a; Code#xf…Problem - D - Codeforces
题意 思路
这道题需要倒着步骤考虑就是先去假设已经分为了两部分这左右两部分的和相等然后去想上一个步骤
倒着一个步骤后可以发现这样的性质 Code
#include bits/stdc.h#define int long longusing i64 long long;constexpr int N 1e5 10;
constexpr int M 1e5 10;
constexpr int P 2600;
constexpr i64 Inf 1e18;
constexpr int mod 1e9 7;
constexpr double eps 1e-6;int n;
int a[N];void solve() {std::cin n;std::mapint,int mp, mp2;int sum 0;for (int i 1; i n; i ) {std::cin a[i];sum a[i];mp2[a[i]] ;}if (sum 1) {std::cout NO \n;return;}int s 0;for (int i 1; i n; i ) {s a[i];mp[a[i]] ;mp2[a[i]] --;if (s sum / 2) {if (mp[s - sum / 2]) {std::cout YES \n;return;}}else if (s sum / 2) {if (mp2[sum / 2 - s]) {std::cout YES \n;return;}}else {std::cout YES \n;return;}}std::cout NO \n;
}
signed main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);int t 1;while (t--) {solve();}return 0;
}