text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
int n, a = 0, b = 0;
int main(int argc, char *argv[]) {
cin >> n;
for (int i = 1, x; i <= n; ++i) {
cin >> x;
if (x == 100)
++a;
else
++b;
}
int sum = 100 * a + 200 * b;
if (sum % 200 != 0)
cout << "NO" << endl;
else {
int half = sum / 2;
bool ans = false;
for (int i = 0; i <= b; ++i)
if (200 * i <= half && half - 200 * i <= a * 100) ans = true;
if (ans)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
fclose(stdin);
fclose(stdout);
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, j, n, sum, one, two, w, flag;
sum = 0;
one = 0;
two = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &w);
w = w / 100;
if (w == 1)
one++;
else
two++;
sum = sum + w;
}
flag = 0;
for (i = 0; i <= one; i++) {
for (j = 0; j <= two; j++) {
if (i + 2 * j == sum - i - 2 * j) {
flag = 1;
break;
}
}
}
if (flag)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, t, a = 0, b = 0;
int main() {
scanf("%d", &n);
while (n > 0) {
scanf("%d", &t);
if (t == 100)
a++;
else
b++;
n--;
}
if (a % 2 == 0) {
if (b % 2 == 0)
printf("YES");
else {
if (a > 1)
printf("YES");
else
printf("NO");
}
} else
printf("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream &operator<<(ostream &os, const pair<first, second> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin()) os << ", ";
os << *it;
}
return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
os << "[";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin()) os << ", ";
os << *it;
}
return os << "]";
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
os << "[";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin()) os << ", ";
os << *it;
}
return os << "]";
}
template <typename first, typename second>
ostream &operator<<(ostream &os, const map<first, second> &v) {
os << "[";
for (auto it = v.begin(); it != v.end(); ++it) {
if (it != v.begin()) os << ", ";
os << it->first << " = " << it->second;
}
return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello &...rest) {
cerr << arg << ' ';
faltu(rest...);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int n, cnt1 = 0, cnt2 = 0, x;
cin >> n;
while (n--) {
cin >> x;
if (x == 100) {
cnt1++;
} else {
cnt2++;
}
}
if (cnt1 % 2 == 1) {
cout << "NO" << '\n';
} else if (cnt1 == 0 && cnt2 % 2 == 1) {
cout << "NO" << '\n';
} else {
cout << "YES" << '\n';
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int d[3] = {};
int n;
cin >> n;
int x;
for (int i = 0; i < n; i++) {
cin >> x;
d[x / 100]++;
}
if ((d[1] % 2 == 0 && d[2] % 2 == 0) || (2 * d[2] == d[1] && d[1] % 2 == 0) ||
(d[2] % 2 != 0 && d[1] % 2 == 0 && d[1] != 0))
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long n, a, s1, on = 0, tw = 0;
cin >> n;
float x;
while (n--) {
cin >> a;
if (a == 100)
on++;
else
tw++;
}
if (on == 0) {
if (tw % 2 == 0)
cout << "YES";
else
cout << "NO";
} else if (tw == 0) {
if (on % 2 == 0)
cout << "YES";
else
cout << "NO";
} else {
s1 = (on * 100 + tw * 200) / 100;
if (s1 % 2 == 0)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, i, sum = 0, h = 0, t = 0, c;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> k;
if (k == 100)
h++;
else
t++;
sum += k;
}
if (h % 2 != 0) {
cout << "NO";
return 0;
} else {
sum = sum / 2;
c = sum / 200;
if (c > t) {
sum = sum - t * 200;
c = sum / 100;
if (c <= h)
cout << "YES";
else
cout << "NO";
} else {
if (h || sum % 200 == 0)
cout << "YES";
else
cout << "NO";
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int m[3];
int main() {
int n;
scanf("%d", &n);
int tmp;
int s = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &tmp);
m[tmp / 100]++;
}
s = (100 * m[1] + 200 * m[2]) / 2;
s %= 200;
if (s == 0)
cout << "YES";
else if (s == 100) {
if (m[1] != 0)
cout << "YES";
else
cout << "NO";
} else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
int w, i;
int a = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &w);
if (w == 100) {
a++;
}
}
if (a % 2 == 1 || (n % 2 == 1 && a == 0)) {
printf("NO\n");
} else {
printf("YES\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, sad, devist;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
if (a == 100) {
sad++;
} else {
devist++;
}
}
if (devist % 2) {
devist = 1;
if (sad >= 2) {
sad -= 2;
if (sad % 2 == 0) {
cout << "YES" << endl;
return 0;
}
}
} else {
devist = 0;
if (sad % 2 == 0) {
cout << "YES" << endl;
return 0;
}
}
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], o = 0, t = 0, sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 100)
o++;
else
t++;
sum += a[i];
}
if (n == 1) {
cout << "NO";
return 0;
}
if ((sum / 100) % 2 != 0) {
cout << "NO" << endl;
return 0;
}
t = t % 2;
if (t == 1) {
t--;
if (o >= 2) {
o -= 2;
if (o == 0) {
cout << "YES" << endl;
return 0;
} else {
if (o % 2 != 0) {
cout << "NO" << endl;
return 0;
} else {
cout << "YES" << endl;
return 0;
}
}
} else {
cout << "NO" << endl;
return 0;
}
} else {
if (o % 2 == 0 && t == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, hundred = 0, twohundred = 0, val;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; ++i) {
cin >> val;
if (val == 100) {
++hundred;
} else {
++twohundred;
}
}
if ((hundred & 1) == 0) {
if ((twohundred & 1)) {
if (hundred == 0) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
} else {
cout << "YES" << endl;
}
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2};
int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1};
void prtn(long long i) { cout << i << "\n"; }
vector<vector<long long> > v;
bool check(vector<long long> v) {
set<long long> s;
for (auto i : v) s.insert(i);
if (s.size() == 1)
return true;
else
return false;
}
int dp[105][20005];
bool solve1(vector<long long> a, long long n, long long rq) {
if (rq == 0) return true;
if (n == 0) return false;
if (a[n - 1] > rq)
return dp[n][rq] = solve1(a, n - 1, rq);
else
return dp[n][rq] = solve1(a, n - 1, rq) || solve1(a, n - 1, rq - a[n - 1]);
}
void solve() {
long long n;
cin >> n;
vector<long long> a(n);
long long h = 0, t_h = 0, f = 0;
for (int i = 0; i < n; i++) cin >> a[i], a[i] == 100 ? h++ : t_h++;
if (n == 1)
f = 0;
else if (2 * t_h == h)
f = 1;
else if (t_h == 0 and h % 2 == 0)
f = 1;
else if (h == 0 and t_h % 2 == 0)
f = 1;
else if (h % 2 == 0 and t_h % 2 == 1 and h > 0)
f = 1;
else if (h % 2 == 0 and t_h % 2 == 0)
f = 1;
if (f)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
int main() {
int t = 1;
while (t--) {
solve();
}
}
|
#include <bits/stdc++.h>
using namespace std;
unsigned long long n, i, s = 0, d = 0, a;
int main() {
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
if (a == 100)
s++;
else
d++;
}
if (s % 2 == 0 && (s != 0 || d % 2 == 0)) {
cout << "YES";
} else {
cout << "NO";
return 0;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int a[105];
int n;
int main() {
while (scanf("%d", &n) != EOF) {
int m = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] == 100) m++;
}
bool f = true;
if ((m == 0) && (n % 2 == 1)) f = false;
if (m % 2 == 1) f = false;
if (f)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool sortcoll(vector<long long int> &v1, vector<long long int> &v2) {
return v1[0] < v2[0];
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long int n;
cin >> n;
long long int arr[n];
for (int i = 0; i < n; i++) cin >> arr[i];
long long int sum = 0;
for (int i = 0; i < n; i++)
if (arr[i] == 100)
sum++;
else
sum += 2;
bool flag = 0;
if (sum % 2 == 0) {
long long int count1 = 0, count2 = 0;
for (int i = 0; i < n; i++)
if (arr[i] == 200)
count2++;
else
count1++;
if (count2 % 2 != 0) {
if (count1 > 0 && count1 % 2 == 0) flag = 1;
} else
flag = 1;
}
flag == 1 ? cout << "YES" : cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int cnt1 = 0, cnt2 = 0, temp;
for (int i = 0; i < n; i++) {
cin >> temp;
if (temp == 100)
cnt1++;
else
cnt2++;
}
if (cnt1 == 0) {
if (cnt2 % 2 == 0)
cout << "YES\n";
else
cout << "NO\n";
} else if (cnt2 == 0) {
if (cnt1 % 2 == 0)
cout << "YES\n";
else
cout << "NO\n";
} else {
int diff = -1;
cnt1 *= 100;
cnt2 *= 200;
if (cnt1 > cnt2)
diff = cnt1 - cnt2;
else
diff = cnt2 - cnt1;
if (diff % 200 == 0)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, one = 0, two = 0, a[102];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
((a[i] / 100) & 1) ? one++ : two++;
}
if (((100 * one + 200 * two) / 100) & 1) {
cout << "NO" << endl;
return 0;
}
sort(a, a + n);
int ans = (100 * one + 200 * two);
for (int i = 0; i < n; i++) {
ans -= a[i];
for (int j = i + 1; j < n; j++) {
if (2 * ans == (100 * one + 200 * two)) {
cout << "YES" << endl;
return 0;
}
ans -= a[j];
}
ans = (100 * one + 200 * two);
}
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e6;
const long long MOD = 1e9 + 7;
const long long N = 1e6 + 7;
const long long N_N = 1e3;
const int INF = 1e9 + 228;
const long double eps = 1e-12;
long long n, m, a[N], res, cnt, ans;
string s, t;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
if (a[i] == 100) ans++;
if (a[i] == 200) res++;
}
if ((ans == 0 && res % 2 != 0) || (res == 0 && ans % 2 != 0)) {
cout << "NO";
return 0;
}
if ((ans % 2 == 0 && res % 2 == 0) || (ans % 2 == 0 && res % 2 != 0)) {
cout << "YES";
return 0;
} else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
vector<int> v;
int k;
cin >> n;
int k1 = 0;
int k2 = 0;
for (int i = 0; i < n; i++) {
cin >> k;
v.push_back(k);
if (k == 100)
k1++;
else if (k == 200)
k2++;
}
if ((k1 % 2 == 0) && (k2 % 2 == 0))
cout << "YES";
else if ((k1 == 0) && (k2 % 2) != 0) {
cout << "NO";
} else if (k2 % 2 != 0 && k1 % 2 == 0) {
if (k1 >= 2) {
cout << "YES";
} else {
cout << "NO";
}
} else
cout << "NO";
v.clear();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, x, m;
cin >> n;
m = 0;
for (i = 0; i < n; i++) {
cin >> x;
if (x == 100) m++;
}
n -= m;
if (n % 2 == 1 && m >= 2) {
m -= 2;
if (m % 2 == 0)
cout << "YES\n";
else
cout << "NO\n";
return 0;
}
if (n % 2 == 0) {
if (m % 2 == 0)
cout << "YES\n";
else
cout << "NO\n";
return 0;
}
cout << "NO\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a1 = 0, a2 = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 100) {
a1++;
} else
a2++;
}
if (a1 % 2 != 0) {
cout << "NO" << endl;
} else {
if (a2 % 2 != 0 && a1 < 2) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int n;
int a[maxn];
int main() {
cin >> n;
int sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum += a[i];
}
int ret = sum / 2;
sort(a, a + n);
for (int i = n - 1; i >= 0; i--) {
if (ret >= a[i]) ret -= a[i];
}
if (ret == 0)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a, b, x;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &x);
if (x == 100)
a++;
else
b++;
}
b %= 2;
if (b == 1) a -= 2;
if (a < 0) {
puts("NO");
return 0;
}
if (a % 2) {
puts("NO");
return 0;
} else {
puts("YES");
return 0;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, tmp;
int c100 = 0, c200 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> tmp;
if (tmp == 100)
c100++;
else
c200++;
}
if (c100 & 1) {
cout << "NO\n";
return 0;
} else if (c200 & 1 && c100 == 0) {
cout << "NO\n";
return 0;
}
cout << "YES\n";
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> v(n);
int hund = 0, two = 0;
for (int i = 0; i < (int)n; i++) {
cin >> v[i];
if (v[i] == 100)
hund++;
else
two++;
}
int full = hund * 100 + two * 200;
if (full % 200 != 0)
cout << "NO\n";
else {
int half = full / 2;
int ans = 0;
for (int i = 0; i < (int)two + 1; i++)
if (half - (i * 200) >= 0 && half - (i * 200) <= hund * 100) ans = 1;
if (ans)
cout << "YES\n";
else
cout << "NO\n";
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
auto start = std::chrono::high_resolution_clock::now();
int t = 1;
while (t--) solve();
auto stop = std::chrono::high_resolution_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
cerr << "\nTime taken : "
<< ((long double)duration.count()) / ((long double)1e9) << " s " << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5 * 1e4 + 10;
int main() {
int n;
cin >> n;
int b, c;
b = 0;
c = 0;
while (n--) {
int a;
cin >> a;
if (a == 100)
b++;
else
c++;
}
if ((2 * c + b) % 2 != 0) {
cout << "NO\n";
return 0;
}
c = c % 2;
if (c == 1 && b >= 2) {
c = 0;
b -= 2;
} else if (c == 1) {
cout << "NO\n";
return 0;
}
if (b % 2 == 0) {
cout << "YES\n";
} else {
cout << "NO\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long int n, count_200 = 0, count_100 = 0;
cin >> n;
vector<long int> v;
for (long int i = 0; i < n; i++) {
long int temp;
cin >> temp;
v.push_back(temp);
if (temp == 200) count_200++;
if (temp == 100) count_100++;
}
if (count_200 == 0) {
if (count_100 % 2 == 0)
cout << "YES";
else
cout << "NO";
} else if (count_100 == 0) {
if (count_200 % 2 == 0)
cout << "YES";
else
cout << "NO";
} else if (count_200 % 2 == 0) {
if (count_100 % 2 == 0)
cout << "YES";
else
cout << "NO";
} else {
if (count_100 % 2 == 0)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int o = 0, t = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x == 100)
o++;
else
t++;
}
if (t == n || o == n) {
puts(n & 1 ? "NO" : "YES");
} else if (t & 1 && o) {
t %= 2;
o -= 2 * t;
puts(o < 0 || o & 1 ? "NO" : "YES");
} else {
puts(o & 1 ? "NO" : "YES");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
int cnt1, cnt2;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
if (x == 100) cnt1++;
}
if ((cnt1 & 1) || (n % 2 == 1 && cnt1 == 0))
puts("NO");
else
puts("YES");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, c1 = 0, c2 = 0, s = 0, a;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s += a;
if (a == 100)
c1++;
else
c2++;
}
if ((s / 100) & 1 || (c2 & 1 && !c1))
cout << "NO";
else
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
int n, i, sum = 0, j = 0, tmp = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
a[i] /= 100;
sum += a[i];
}
if (sum % 2) {
puts("NO");
return 0;
}
sum /= 2;
sort(a, a + n);
i = 0;
tmp = a[0];
while (i < n && j < n) {
if (tmp < sum) {
j++;
tmp += a[j];
} else if (tmp == sum) {
puts("YES");
return 0;
} else {
tmp -= a[i];
i++;
}
}
puts("NO");
return 0;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, a = 0, b = 0;
scanf("%d", &n);
if (n == 1) {
cout << "NO";
return (0);
}
for (int i = 0; i < n; i++) {
scanf("%d", &x);
if (x == 100)
a++;
else
b++;
}
if (a % 2)
cout << "NO";
else {
if (!(b % 2))
cout << "YES";
else if (b % 2 && a >= 2)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x[101], count100 = 0, count200 = 0;
cin >> n;
for (int i = 0; i <= n - 1; i++) cin >> x[i];
for (int j = 0; j <= n - 1; j++)
if (x[j] == 100)
count100++;
else
count200++;
if ((count100 + (count200 * 2)) % 2 == 0)
if ((count100 == 0 && ((count200) % 2) == 1))
cout << "NO" << endl;
else
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9;
bool check(long long a, long long b) { return a < b; }
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
{
long long n;
cin >> n;
long long k, a[n], x = 0, y = 0, e = 0, o = 0;
for (long long i = 0; i < n; ++i) {
cin >> a[i];
if (a[i] == 200)
e++;
else
o++;
}
if (n == 1 || (n % 2 != 0 && (e == 0 || o == 0)))
cout << "NO";
else if (e % 2 == 0 && o % 2 == 0) {
cout << "YES";
} else if (o % 2 == 0) {
cout << "YES";
} else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt100 = 0, cnt200 = 0;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
if (a == 100) {
cnt100++;
} else {
cnt200++;
}
}
if (cnt200 % 2 != 0) {
cnt100 = cnt100 - 2;
}
if (cnt100 % 2 == 0 && cnt100 >= 0) {
cout << "YES";
} else {
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0, i, input, even = 0, odd = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> input;
if (input == 100) {
odd++;
} else {
even++;
}
}
if (odd % 2 == 0 && odd >= even % 2) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
long long gcd(long long m, long long n) {
long long r;
while (n != 0) {
r = m % n;
m = n;
n = r;
}
return m;
}
long long expmod(long long a, long long b) {
long long x = 1, y = a;
while (b > 0) {
if (b & 1) x = (x * y) % 1000000007;
y = (y * y) % 1000000007;
b >>= 1;
}
return (x) % 1000000007;
}
long long inv(long long n) { return expmod(n, 1000000007 - 2); }
int main() {
int n;
cin >> n;
int a = 0, b = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
if (temp == 100)
a++;
else
b++;
}
b = b % 2;
if (b == 1) {
if (a <= 1) {
cout << "NO" << endl;
return 0;
}
a = a - 2;
}
if (a % 2 == 1) {
cout << "NO" << endl;
} else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, w, v1, v2, cont1, cont2, q, total;
bool flag = 0;
cin >> n;
cont1 = cont2 = 0;
for (int i = 0; i < n; i++) {
cin >> w;
if (w == 100)
cont1++;
else
cont2++;
}
if (n == 1)
cout << "NO";
else {
if ((cont1 * 100) == (cont2 * 200))
cout << "YES";
else {
total = (cont1 * 100) + (cont2 * 200);
q = total / 2;
for (int i = 0; i <= cont1 and !flag; i++) {
for (int j = 0; j <= cont2 and !flag; j++) {
v1 = (i * 100) + (j * 200);
v2 = total - v1;
if (v1 == v2) flag = 1;
}
}
if (flag)
cout << "YES";
else
cout << "NO";
}
}
cout << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum = 0;
cin >> n;
int A[n], B[2] = {0};
for (int i = 0; i < n; i++) {
cin >> A[i];
sum += A[i];
if (A[i] == 100) {
B[0]++;
} else {
B[1]++;
}
}
if (n == 1) {
cout << "NO\n";
return 0;
}
if (sum % 200 == 0) {
if (B[0] == 0 && n % 2 != 0) {
cout << "NO\n";
} else {
cout << "YES\n";
}
} else {
cout << "NO\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int f[1000], k[1000][2];
int main() {
int n, sum = 0, t;
scanf("%d", &n);
int k1 = 0, k2 = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &t);
if (t == 100)
k1++;
else
k2++;
}
sum = k1 + k2 * 2;
if (sum % 2 != 0) {
cout << "NO";
return 0;
}
sum /= 2;
f[0] = 1;
k[0][0] = k1;
k[0][1] = k2;
for (int i = 0; i <= sum; i++)
if (f[i]) {
if (!f[i + 1] && k[i][0]) {
f[i + 1] = 1;
k[i + 1][0] = k[i][0] - 1;
k[i + 1][1] = k[i][1];
}
if (!f[i + 2] && k[i][1]) {
f[i + 2] = 1;
k[i + 2][0] = k[i][0];
k[i + 2][1] = k[i][1] - 1;
}
}
if (f[sum])
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, count1 = 0, count2 = 0;
scanf("%d", &n);
while (n--) {
scanf("%d", &a);
if (a == 100)
count1++;
else
count2++;
}
if ((count1 + 2 * count2) % 2 != 0)
printf("NO");
else {
if (count2 % 2 == 0)
printf("YES");
else if (count1 != 0) {
printf("YES");
} else
printf("NO");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double INF = 0x7ffffff;
const int N = 250;
int n, a[N];
int main() {
ios::sync_with_stdio(false);
while (scanf("%d", &n) != EOF) {
int tot = 0;
int t1 = 0, t2 = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
tot += a[i] / 100;
if (a[i] == 100)
t1++;
else
t2++;
}
if (tot % 2 || (t2 % 2 && t1 == 0))
puts("NO");
else {
puts("YES");
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, te, h = 0, t;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> te;
if (te == 100) {
h++;
}
}
t = n - h;
if (t % 2 == 0) {
if (h % 2 == 0) {
cout << "YES\n";
} else {
cout << "NO\n";
}
} else {
h = h - 2;
if (h < 0) {
cout << "NO\n";
} else if (h % 2 == 0) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
return 0;
}
|
#include <bits/stdc++.h>
long long int mod = 1000000007;
using namespace std;
int main() {
int n;
cin >> n;
int a[n], i, sum = 0, z = 0, x = 0;
for (i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
if (a[i] == 200) {
z++;
} else {
x++;
}
}
if (n == 1) {
cout << "NO";
return 0;
}
if ((sum / 2) % 100 == 0 && x != 0) {
cout << "YES";
} else if (x == 0 && n % 2 == 0) {
cout << "YES";
} else if (x == 0 && n % 2 != 0) {
cout << "NO";
} else {
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum = 0;
cin >> n;
int w[n];
if (n < 2) {
cout << "NO";
return 0;
}
if (n >= 2) {
for (int i = 0; i < n; i++) {
cin >> w[i];
sum = sum + w[i];
}
if (n % 2 != 0 && sum == n * 200) {
cout << "NO";
return 0;
} else if (sum / 2 / 10 % 10 == 0) {
cout << "YES";
return 0;
} else {
cout << "NO";
return 0;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, a = 0, b = 0;
cin >> n;
for (int i = 1, x; i <= n; ++i) {
cin >> x;
if (x == 100)
++a;
else
++b;
}
int sum = 100 * a + 200 * b;
if (sum % 200 != 0)
cout << "NO" << endl;
else {
int half = sum / 2;
bool ans = false;
for (int i = 0; i <= b; ++i)
if (200 * i <= half && half - 200 * i <= a * 100) ans = true;
if (ans)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, w, one = 0, two = 0, sum = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> w;
if (w == 100) {
one++;
} else {
two++;
}
sum += w;
}
if (two % 2 == 0) {
if (one % 2 == 0) {
cout << "YES";
} else {
cout << "NO";
}
} else {
one -= 2;
if (one < 0) {
cout << "NO";
return 0;
}
if (one % 2 == 0) {
cout << "YES";
} else {
cout << "NO";
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n;
int c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
cin >> x;
if (x == 100)
c1++;
else
c2++;
}
if (c1 % 2 == 1) {
cout << "NO" << endl;
return 0;
}
if ((c1 == 0) && (c2 % 2 == 1)) {
cout << "NO" << endl;
return 0;
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int count200 = 0;
int count100 = 0;
for (int i = 0; i < n; i++) {
if (arr[i] == 100)
count100++;
else
count200++;
}
if (count200 == 0) {
if (count100 % 2 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} else {
count200 = count200 % 2;
if (count100 >= (2 * count200)) {
if ((count100 - (2 * count200)) % 2 == 0) {
cout << "YES" << endl;
return;
} else {
cout << "NO" << endl;
return;
}
} else {
cout << "NO" << endl;
return;
}
}
}
int main() {
int t;
t = 1;
while (t--) {
solve();
}
}
|
#include <bits/stdc++.h>
using namespace std;
map<long long, bool> tz;
int gcd(int a, int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int cnk(long long n, long long k, long long mod) {
long long result = 1;
int lal = 0;
for (int lol = n; lal < k; lal++, lol--) {
result *= lol;
result %= mod;
}
return result;
}
const long long mod = 1e9 + 7;
vector<long long> graph[100000];
vector<pair<long long, long long> > vec1;
vector<pair<long long, long long> > vec2;
vector<long long> vec;
long long mas[100000];
vector<long long> nap[4];
bool masi[100000];
long long mas1[100];
long long mas2[100];
string s;
long long power(long long a, long long b) {
long long res = 1;
for (long long i = 0; i < b; i++) {
res *= a;
}
return res;
}
bool comp(long long a, long long b) { return a > b; }
string tostr(long long a) {
ostringstream out;
out << a;
return out.str();
}
map<string, long long> ochki;
int main() {
long long a, b, k;
cin >> a;
long long a1 = 0, a2 = 0;
for (long long lol = 0; lol < a; lol++) {
cin >> k;
if (k == 100) {
a1++;
} else
a2++;
}
if (a2 % 2 == 0) {
if (a1 % 2 == 0) {
cout << "YES";
} else
cout << "NO";
} else {
if (a1 >= 2 && a1 % 2 == 0) {
cout << "YES";
} else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, i, o = 0, t = 0, s = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
s += x;
if (x == 100) {
o++;
} else
t++;
}
if (o == 0) {
if (t % 2 == 0) {
cout << "YES";
} else
cout << "NO";
} else if ((s % 200) != 0) {
cout << "NO";
} else {
s = s / 2;
if (s % 100 == 0) {
cout << "YES";
} else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[101], ans = 0;
cin >> n;
bool flag = false;
for (int i = 1; i <= n; i += 1) {
cin >> a[i];
if (a[i] == 100) flag = true;
ans += a[i];
}
if (ans % 200 == 100)
cout << "NO" << endl;
else {
if (ans % 400 == 0)
cout << "YES" << endl;
else if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void s() {
int n;
cin >> n;
int a[n], c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 100)
c1++;
else
c2++;
}
int sum = c1 * 100 + c2 * 200;
if (sum % 200 != 0)
cout << "NO";
else {
int f = 0;
for (int i = 0; i <= c2; i++) {
if (200 * i <= sum / 2 && sum / 2 - 200 * i <= c1 * 100) f = 1;
}
if (f == 1)
cout << "YES";
else
cout << "NO";
}
}
int main() {
long long int t;
t = 1;
while (t--) {
s();
cout << "\n";
}
}
|
#include <bits/stdc++.h>
int main() {
unsigned short n;
unsigned short ac1;
unsigned short i;
unsigned short w;
unsigned short ac2;
unsigned short gw;
if (scanf("%hu", &n) != 1) return -1;
if (n < 1 || n > 100) return -1;
ac1 = 0;
for (i = 0; i < n; i++) {
if (scanf("%hu", &w) != 1) return -1;
if (w != 100 && w != 200) return -1;
if (w == 100) ac1++;
}
ac2 = n - ac1;
gw = 50 * (ac1 + 2 * ac2);
if (!(gw % 200) || (!(gw % 100) && ac1))
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template <typename T>
inline T Bigmod(T base, T power, T MOD) {
T ret = 1;
while (power) {
if (power & 1) ret = (ret * base) % MOD;
base = (base * base) % MOD;
power >>= 1;
}
return ret;
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
return (a.first > b.first);
}
int main() {
ios::sync_with_stdio(false);
int n;
while (cin >> n) {
int hun = 0, th = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x == 100)
hun++;
else
th++;
}
int sum = hun * 100 + th * 200;
if (sum % 200 != 0) {
cout << "NO\n";
} else {
int h = sum / 2;
bool ans = 0;
for (int i = 0; i <= th; i++) {
if (i * 200 <= h && h - i * 200 <= hun * 100) ans = 1;
}
if (ans)
cout << "YES\n";
else
cout << "NO\n";
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int n1;
int n2;
while (cin >> n) {
n1 = n2 = 0;
int temp;
bool flag = false;
while (n--) {
cin >> temp;
if (temp == 100)
++n1;
else
++n2;
}
if (n1 % 2)
flag = false;
else {
n1 /= 2;
if (n1 != 0)
flag = true;
else {
if (n2 % 2)
flag = false;
else
flag = true;
}
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int a1[3] = {0};
int main() {
int n, ans = 0;
vector<int> vec;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
vec.push_back(x);
ans += x / 100;
a1[(x / 100) - 1]++;
}
int cn = 0;
if (ans % 2 != 0)
cout << "NO";
else {
if (a1[0] == 0) {
if (a1[1] % 2 == 0) cn = 1;
} else if (a1[1] == 0) {
if (a1[0] % 2 == 0) cn = 1;
} else {
for (int il = 1; il <= (a1[0] + 2 * a1[1]) / 2; il++) {
ans = a1[0] + (2 * a1[1]) - il;
ans -= il;
if (ans == 0) {
cn = 1;
break;
}
}
}
if (cn == 1)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
int n;
scanf("%d", &n);
int sum = 0;
int t1 = 0, t2 = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
sum += a[i];
if (a[i] == 100)
t1++;
else
t2++;
}
if ((sum / 100) % 2 != 0) {
puts("NO");
return 0;
}
int tmp = 0;
while (t2) {
tmp += 200;
if (tmp == sum / 2) {
puts("YES");
return 0;
} else if (tmp > sum / 2) {
if (t1) {
puts("YES");
return 0;
} else {
puts("NO");
return 0;
}
}
t2--;
}
puts("YES");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, a = 0, b = 0, ok = 1;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &x);
if (x == 100)
a++;
else {
b++;
}
}
b = (b & 1);
if (b) a -= 2;
if (a < 0) ok = 0;
if (a & 1) ok = 0;
puts(ok ? "YES" : "NO");
}
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5;
void solve() {
long long n;
cin >> n;
long long o, t;
o = t = 0;
long long w;
for (long long i = 0; i < n; i++) {
cin >> w;
if (w == 100)
o++;
else {
t++;
}
}
if (o % 2 || (o == 0 && t % 2)) {
cout << "NO";
return;
}
cout << "YES";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long t = 1;
while (t--) solve();
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int sum, n, x;
int a, b;
while (~scanf("%d", &n)) {
sum = 0;
while (n--) {
scanf("%d", &x);
x /= 100;
sum += x;
x % 2 ? a++ : b++;
}
if (!a && b % 2 || sum % 2)
printf("NO\n");
else
printf("YES\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, n100 = 0, n200 = 0, i, app;
cin >> n;
for (i = 0; i < n; i++) {
cin >> app;
if (app == 100)
n100++;
else
n200++;
}
if (n100 == 0 || n200 == 0) {
if (n100 % 2 == 0 && n200 % 2 == 0) {
cout << "YES";
} else {
cout << "NO";
}
} else {
int rest = abs(n100 - 2 * n200);
if (rest % 2 == 0)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a = 0, b = 0, n, i, x;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
if (x == 100)
a++;
else
b++;
}
if (b == 0 && a % 2 == 0 && a != 0)
cout << "YES" << endl;
else if (a == 0 && b != 0 && b % 2 == 0)
cout << "YES" << endl;
else if (a % 2 == 0 && a != 0 && b != 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int high_bit_finder(long long int a) { return log2(a) + 1; }
void solve() {
int n;
cin >> n;
int a[n];
int c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 100) {
c1++;
} else {
c2++;
}
}
long long int sum = 0;
for (int i = 0; i < n; i++) sum += a[i];
if (sum % 200 != 0) {
cout << "NO" << '\n';
return;
}
sum = sum / 2;
for (int i = 0; i <= c2; i++) {
if (200 * i <= sum && sum - 200 * i <= 100 * c1) {
cout << "YES" << '\n';
return;
}
}
cout << "NO" << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int sum = 0, sum1 = 0, sum2 = 0;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
sum += k;
if (k == 100) {
sum1++;
} else {
sum2++;
}
}
if (n == 1) {
puts("NO");
continue;
}
if (sum % 2 != 0) {
puts("NO");
continue;
}
int k = sum / 2;
int flag = 0;
for (int i = 0; i <= sum1; i++) {
for (int j = 0; j <= sum2; j++) {
if (i * 100 + j * 200 == k) {
flag = 1;
break;
}
}
if (flag) break;
}
if (flag) {
puts("YES");
} else {
puts("NO");
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int N = 100001;
int mod = 1e9 + 7;
int min(int a, int b) {
if (a < b)
return a;
else
return b;
}
int max(int a, int b) {
if (a > b)
return a;
else
return b;
}
int power(int a, int b) {
int res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
return res;
}
int gcd(int p, int q) {
if (p % q == 0)
return q;
else {
return gcd(q, p % q);
}
}
bool comp(int a, int b) { return (a > b); }
void solve() {
int n;
cin >> n;
vector<int> v(n);
int c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
cin >> v[i];
if (v[i] == 100)
c1++;
else
c2++;
}
if (c1 % 2 == 1)
cout << "NO";
else if (c1 == 0 && c2 % 2 == 1)
cout << "NO";
else
cout << "YES";
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
int a[2];
a[0] = 0;
a[1] = 0;
cin >> n;
int i;
for (i = 0; i < n; i++) {
cin >> x;
if (x == 100)
a[0]++;
else
a[1]++;
}
if (a[0] % 2 == 0) {
if (a[1] % 2 == 0)
cout << "YES\n";
else if (a[0] >= 2)
cout << "YES\n";
else
cout << "NO\n";
} else
cout << "NO\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int t;
while (cin >> n) {
int weight[n];
t = 0;
for (int x = 0; x < n; x++) {
cin >> weight[x];
t += weight[x];
}
int m = (t / 100) - n;
int o = n - m;
if (o == 0 && m == 1)
o = 1;
else if (o == 0 && m % 2 == 1)
o = 1;
if (o % 2)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, l, r;
int main() {
cin >> n;
while (n--) {
cin >> m;
if (m == 100)
l++;
else
r++;
}
if (l & 1)
cout << "NO";
else if (r & 1) {
if (!l)
cout << "NO";
else
cout << "YES";
} else {
cout << "YES";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, one = 0, two = 0, a[102];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
((a[i] / 100) & 1) ? one++ : two++;
}
if (((100 * one + 200 * two) / 100) & 1) {
cout << "NO" << endl;
return 0;
}
sort(a, a + n);
int ans = (100 * one + 200 * two);
for (int i = 0; i < n; i++) {
ans -= a[i];
for (int j = i + 1; j < n; j++) {
if (2 * ans == (100 * one + 200 * two)) {
cout << "YES" << endl;
return 0;
}
ans -= a[j];
}
ans = (100 * one + 200 * two);
}
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, n, sum = 0, m, c = 0, c1 = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &m);
if (m == 200)
c++;
else
c1++;
sum += m;
}
if (n < 2 || sum % 200 != 0 || (c % 2 == 1 && c1 == 0)) {
printf("NO\n");
} else
printf("YES\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 100100, mod = 1e9 + 7, mod2 = 1e9 + 9, mod3 = 998244353,
sq = 450, base = 727, lg = 30;
long long n, m, x, y, z, w, ans, t;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
x /= 100;
if (x == 2)
y++;
else
z++;
}
for (int i = 0; i <= y; i++) {
for (int j = 0; j <= z; j++) {
if (i * 2 + j * 1 == (y - i) * 2 + (z - j) * 1) return cout << "YES", 0;
}
}
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[10010];
int main() {
int n, suma = 0, sumb = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
if (x == 100) suma++;
if (x == 200) sumb++;
}
if (suma == 0 || sumb == 0) {
if (suma == 0 && sumb % 2 == 0) {
cout << "YES";
return 0;
}
if (suma % 2 == 0 && sumb == 0) {
cout << "YES";
return 0;
}
cout << "NO";
return 0;
}
if (suma % 2 == 0 && sumb % 2 == 1) {
cout << "YES";
return 0;
}
if (suma % 2 == 0 && sumb % 2 == 0) {
cout << "YES";
return 0;
}
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a = 0, b = 0;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
if (c == 100)
a++;
else
b++;
}
if (a == 0 && b % 2 == 1)
cout << "NO";
else if (a % 2 == 0)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, one = 0, two = 0, sum = 0;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
for (int nn = 0; nn < n; nn++) {
sum += v[nn];
if (v[nn] == 100) {
one += 1;
} else {
two += 1;
}
}
if (sum % 200 != 0) {
cout << "NO" << endl;
} else if (sum % 200 == 0 && one == 0) {
if (two % 2 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} else {
cout << "YES" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, sum, val, tw, on;
cin >> n;
on = 0;
tw = 0;
while (n--) {
cin >> val;
if (val == 200)
tw += 1;
else
on += 1;
}
if (on > 1 && on % 2 == 0)
cout << "YES" << endl;
else if (on == 0 && tw % 2 == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], sum = 0, cunt = 0, loda = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
if (a[i] == 100)
cunt++;
else
loda++;
}
if ((cunt > 0 && cunt % 2 == 0) || sum % 400 == 0) {
cout << "YES\n";
} else
cout << "NO\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
int s = 0, d = 0;
for (int i = 0; i < n; i++) {
cin >> arr[i];
s += arr[i];
}
d = s / 2;
if (d % 100 != 0) {
cout << "NO";
} else {
int c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
if (arr[i] == 200)
c2++;
else
c1++;
}
if (c2 != 0) {
if (d / 200 >= c2) {
c1 -= (d - 200 * c2) / 100;
if (c1 < 0) {
cout << "NO";
return 0;
}
if (c1 * 100 != d)
cout << "NO";
else
cout << "YES";
} else {
c2 -= d / 200;
c1 -= (d - 200 * (d / 200)) / 100;
if (c1 < 0) {
cout << "NO";
return 0;
}
if (c2 * 200 + c1 * 100 != d)
cout << "NO";
else
cout << "YES";
}
} else {
if (c1 / 2 * 100 != d)
cout << "NO";
else
cout << "YES";
}
}
return 0;
}
|
#include <bits/stdc++.h>
int main(void) {
int apple[10000];
int num, i, ans = 0, k = 0, f = 0, j, flag = 0;
;
scanf("%d", &num);
for (i = 0; i < num; i++) {
scanf("%d", &apple[i]);
if (apple[i] == 100)
k++;
else
f++;
ans += apple[i];
}
ans /= 2;
for (i = 0; i <= f; i++) {
for (j = 0; j <= k; j++) {
if (i * 200 + j * 100 == ans) {
flag = 1;
break;
}
}
if (flag) break;
}
if (flag)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100009], w1, w2;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] == 100)
w1++;
else
w2++;
}
w2 %= 2;
if (w2 && w1 < 2) {
cout << "NO";
return 0;
}
if (w2) w2 = 0, w1 -= 2;
if (w1 % 2)
cout << "NO";
else
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
void Solve() {
int n;
cin >> n;
int One = 0, Two = 0;
for (int64_t i = 0; i < n; ++i) {
int x;
cin >> x;
if (x == 100) {
One++;
} else {
Two++;
}
}
if (One % 2 == 1) {
cout << "NO" << endl;
} else if (One == 0 && Two % 2 == 1) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
int main() {
ios::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
Solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int i, ctr, j, n, k, l, m, d, ctr1, t, sum, num;
int main() {
ctr1 = 0;
ctr = 0;
cin >> n;
sum = 0;
for (i = 0; i < n; i++) {
cin >> t;
if (t == 100)
ctr++;
else
ctr1++;
}
if (ctr != 0) {
if (ctr % 2 == 0)
printf("YES\n");
else
printf("NO\n");
} else {
if (ctr1 % 2 != 0)
printf("NO\n");
else
printf("YES\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
int suma = 0;
for (int i = 0; i < n; i++) {
cin >> v[i];
suma += v[i];
}
if (suma % 200 == 0 and (suma != 200 * n or n % 2 == 0)) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, s = 0;
char flag = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int a;
scanf("%d", &a);
s += a;
if (a == 100) flag = 1;
}
if (s % 200 != 0 || n == 1 || (!flag && n % 2 != 0))
printf("NO");
else
printf("YES");
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
cin >> N;
int s = 0, a = 0, b = 0, x;
for (int i = 0; i < int(N); i++) {
cin >> x;
s += x;
if (x == 100)
a++;
else
b++;
}
int i, j;
bool f = false;
for (i = 0; i <= a; i++) {
for (j = 0; j <= b; j++) {
if (100 * i + 200 * j == s / 2) f = true;
}
}
if (!f)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int n, sum = 0;
std::cin >> n;
int c1 = 0, c2 = 0;
for (int i = 0, tp; i < n; ++i) {
std::cin >> tp;
if (tp == 100)
++c1;
else
++c2;
}
sum = c1 + c2 * 2;
if (sum % 2) {
std::cout << "NO";
return 0;
}
sum /= 2;
if (sum % 2 && !c1) {
std::cout << "NO";
return 0;
}
std::cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
bool binary(vector<int> v, int key) {
int lo = 0, hi = v.size() - 1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (v[mid] == key)
return true;
else if (v[mid] < key)
lo = mid + 1;
else
hi = mid - 1;
}
return false;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
if (a.first == b.first)
return a.second > b.second;
else
return a.first < b.first;
}
long long fact(long long n) {
if (n == 1 || n == 0)
return 1;
else
return n * fact(n - 1);
}
set<string> b;
void permutations(string str, int i, int n) {
if (i == n - 1) {
b.insert(str);
return;
}
for (int j = i; j < n; j++) {
swap(str[i], str[j]);
permutations(str, i + 1, n);
swap(str[i], str[j]);
}
}
bool compp(const pair<int, int> &a, const pair<int, int> &b) {
return a.second > b.second;
}
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
sort(v.begin(), v.end());
if (v[0] == v[n - 1]) {
if (v.size() % 2 == 0)
cout << "YES";
else
cout << "NO";
} else {
int n100 = 0, n200 = 0;
for (int i : v) i == 100 ? n100++ : n200++;
if (n100 % 2 == 0)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, aux, total, target, total_100 = 0, total_200 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> aux;
if (aux == 100) {
total_100++;
} else {
total_200++;
}
}
total = total_100 * 100 + total_200 * 200;
target = total / 2;
aux = min(total_200, target / 200) * 200;
target -= aux;
aux = min(total_100, target / 100) * 100;
target -= aux;
if (!target) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> n;
map<int, int> co;
while (n--) {
cin >> t;
co[t]++;
}
bool flag = true;
if (co[100] % 2 == 1 || (co[200] % 2 == 1 && co[100] == 0)) {
cout << "NO";
} else
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, y, tmp;
bool flag = false;
cin >> n;
int apple[n];
for (int i = 0; i < n; i++) cin >> apple[i];
x = apple[0];
for (int i = 1; i < n; i++) {
y = apple[i];
for (int j = 1; j < n; j++) {
if (j == i) continue;
tmp = apple[j];
if (x <= y)
x += tmp;
else
y += tmp;
}
if (x == y) {
cout << "YES" << endl;
flag = true;
break;
} else {
x = apple[0];
flag = false;
}
}
if (!flag) cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int N, v[105], i, S1, S2;
int main() {
scanf("%d", &N);
for (i = 1; i <= N; i++) scanf("%d", &v[i]);
sort(v + 1, v + N + 1);
for (i = N; i; i--) {
if (S1 < S2)
S1 += v[i];
else
S2 += v[i];
}
if (S1 == S2)
printf("YES");
else
printf("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
int n;
cin >> n;
int c1 = 0, c2 = 0, temp;
for (int i = 0; i < n; ++i) {
cin >> temp;
if (temp == 100)
c1++;
else
c2++;
}
if (c1 == 0 && c2 % 2 == 1) {
cout << "NO";
return 0;
}
if (c1 % 2 == 1) {
cout << "NO";
return 0;
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt1 = 0, cnt2 = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x == 100) {
cnt1++;
} else {
cnt2++;
}
}
if (cnt1) {
if (cnt1 % 2 == 0) {
cout << "YES";
} else {
cout << "NO";
}
} else {
if (cnt2 % 2 == 0) {
cout << "YES";
} else {
cout << "NO";
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (scanf("%d", &n) != EOF) {
int vet[n];
int cem = 0, duzentos = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &vet[i]);
if (vet[i] == 100)
cem++;
else
duzentos++;
}
if (cem == 0 && duzentos == 0)
printf("YES\n");
else if (cem == 0 && duzentos % 2 == 0)
printf("YES\n");
else if (cem == 0 && duzentos % 2 == 1)
printf("NO\n");
else if (duzentos == 0 && cem % 2 == 0)
printf("YES\n");
else if (duzentos == 0 && cem % 2 == 1)
printf("NO\n");
else if (duzentos % 2 == 0 && cem % 2 == 0)
printf("YES\n");
else if (duzentos % 2 == 0 && cem % 2 == 1)
printf("NO\n");
else if (duzentos % 2 == 1 && cem % 2 == 0)
printf("YES\n");
else if (duzentos % 2 == 1 && cem % 2 == 1)
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
int n;
int a, b;
int w;
int main() {
while (scanf("%d", &n) != -1) {
a = b = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &w);
if (w == 100)
a++;
else
b++;
}
if (b % 2 == 0 && a % 2 == 0) {
printf("YES\n");
} else if (a % 2 == 1 && b % 2 == 0) {
printf("NO\n");
} else if (a % 2 == 1 && b % 2 == 1) {
printf("NO\n");
} else if (a % 2 == 0 && b % 2 == 1) {
if (a >= 2)
printf("YES\n");
else
printf("NO\n");
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long int n;
cin >> n;
long long int A[n];
long long int n1 = 0, n2 = 0;
for (long long int i = 0; i < n; i++) {
cin >> A[i];
if (A[i] == 100)
n1++;
else
n2++;
}
if (n1 % 2 == 1 && n2 % 2 == 0) {
cout << "NO" << endl;
;
} else if (n1 % 2 == 1 && n2 % 2 == 1) {
cout << "NO" << endl;
;
} else if (n1 % 2 == 0 && n2 % 2 == 0) {
cout << "YES" << endl;
;
} else if (n1 % 2 == 0 && n2 % 2 == 1 && n1 > 0) {
cout << "YES" << endl;
;
} else {
cout << "NO" << endl;
};
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c[2], t;
while (cin >> n) {
c[0] = c[1] = 0;
for (int i = 0; i < n; i++) cin >> t, c[t / 100 - 1]++;
if ((c[0] & 1) || ((c[1] & 1) && !c[0]) || (n == 1))
cout << "NO";
else
cout << "YES";
cout << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, w, v1, v2, cont1, cont2, q, total;
bool flag = 0;
cin >> n;
cont1 = cont2 = 0;
for (int i = 0; i < n; i++) {
cin >> w;
if (w == 100)
cont1++;
else
cont2++;
}
if (n == 1)
cout << "NO";
else {
if (cont1 % 2 == 0) {
if (!cont1) {
if (cont2 % 2 == 0)
cout << "YES";
else
cout << "NO";
} else
cout << "YES";
} else
cout << "NO";
}
cout << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> a(n);
int one = 0, two = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == 100) {
one++;
} else {
two++;
}
}
if (one % 2 == 0 && two % 2 == 0) {
cout << "YES\n";
return 0;
}
if (two % 2) {
if (one % 2 == 0 && one > 0) {
cout << "YES\n";
} else {
cout << "NO\n";
}
} else {
if (one % 2 == 0 && one > 0) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.