Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- #include <string>
- #include <vector>
- using namespace std;
- int main()
- {
- system ("color B");
- setlocale(LC_ALL, "rus");
- ios_base::sync_with_stdio(0);
- int n, r = 0;
- cin >> n;
- for (r = 0; r < n; r++)
- {
- int a;
- cin >> a;
- vector <long long> v;
- for (int i = 0; i < a; i++)
- {
- long long c;
- cin >> c;
- v.push_back(c);
- }
- for (int i = 0; i < a; i++)
- {
- sort(v.begin(), v.end());
- for (int j = 1; j < a; j++)
- {
- if (v[j] == v[j - 1] && v[j] != 2048)
- {
- v[j] *= 2;
- v[j - 1] = 1;
- }
- }
- }
- int t = 0;
- for (int i = 0; i < a; i++)
- {
- if (v[i] == 2048)
- t++;
- }
- if(t == 0)
- cout << "NO" << endl;
- else
- cout << "YES" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement