1013A - Piles With Stones - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

n = int(input())
q = list(map(int, input().split()))
s = list(map(int, input().split()))

if sum(q) >= sum(s):
    print("YES")

else:
    print("NO")

C++ Code:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> v;
typedef unordered_map<int, int> mp;
typedef vector<ll> vll;
#define nl cout << endl;
#define F first
#define S second
#define pf pop_back
#define pb push_back
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define all(v) v.begin(), v.end()
#define dec(v) v.rbegin(), v.rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define decimal(n) fixed << setprecision(n)
#define fast                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cin.tie(nullptr);             \
	cout.tie(nullptr);
// #define d 1000000007
#define lu unsigned long long int

void solve()
{
	int n;
	cin >> n;
	int a[n], b[n], s1 = 0, s2 = 0;
	rep(i, n)
	{
		cin >> a[i];
		s1 += a[i];
	}
	rep(i, n)
	{
		cin >> b[i];
		s2 += b[i];
	}
	if (s1 >= s2)
		yes;
	else
		no;
}
int main()
{
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	fast;
	ll t = 1;
	// cin >> t;
	while (t--)
	{
		solve();
	}
}


Comments

Submit
0 Comments
More Questions

894A - QAQ
1551A - Polycarp and Coins
313A - Ilya and Bank Account
1469A - Regular Bracket Sequence
919C - Seat Arrangements
1634A - Reverse and Concatenate
1619C - Wrong Addition
1437A - Marketing Scheme
1473B - String LCM
1374A - Required Remainder
1265E - Beautiful Mirrors
1296A - Array with Odd Sum
1385A - Three Pairwise Maximums
911A - Nearest Minimums
102B - Sum of Digits
707A - Brain's Photos
1331B - Limericks
305B - Continued Fractions
1165B - Polycarp Training
1646C - Factorials and Powers of Two
596A - Wilbur and Swimming Pool
1462B - Last Year's Substring
1608B - Build the Permutation
1505A - Is it rated - 2
169A - Chores
765A - Neverending competitions
1303A - Erasing Zeroes
1005B - Delete from the Left
94A - Restoring Password
1529B - Sifid and Strange Subsequences