Submission #354987

#TimeUsernameProblemLanguageResultExecution timeMemory
354987valerikkFootball (info1cup20_football)C++11
100 / 100
37 ms2412 KiB
#include <bits/stdc++.h>

using namespace std;

const int K = 31;
const int N = 1e5 + 7;

int n, k;
int sz[N];

int game() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        cin >> sz[i];
    int res = 0;
    while (true) {
        int xr = 0;
        for (int i = 0; i < n; ++i)
            xr ^= sz[i];
        if (xr & 1) {
            res = 1;
            break;
        }
        if (k == 1)
            break;
        k >>= 1;
        for (int i = 0; i < n; ++i)
            sz[i] >>= 1;
    }
    return res;
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    string ans = "";
    while (t--)
        ans.push_back('0' + game());
    cout << ans << "\n";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...