Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <cmath>
- #include <iostream>
- #include <map>
- #include <set>
- #include <string>
- #include <tuple>
- #include <unordered_map>
- #include <unordered_set>
- #include <vector>
- typedef long long ll;
- using namespace std;
- // Agar.io
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- int n = 0;
- cin >> n;
- vector<ll> a(n);
- vector<ll> s(n);
- for (int i = 0; i < n; ++i) {
- cin >> a[i];
- s[i] = a[i] + (i == 0 ? 0 : s[i - 1]);
- }
- if (n == 1) {
- cout << 1 << endl;
- return 0;
- }
- int first_cool = 0;
- for (; first_cool < n && a[first_cool] == a[0]; ++first_cool);
- for (int i = first_cool; i < n - 1; ++i) {
- if (s[i] <= a[i + 1]) first_cool = i + 1;
- }
- for (int i = 0; i < first_cool; ++i) cout << 0 << endl;
- for (int i = first_cool; i < n; ++i) cout << 1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement