Submission #845059

# Submission time Handle Problem Language Result Execution time Memory
845059 2023-09-06T11:45:00 Z M_W_13 Football (info1cup20_football) C++17
100 / 100
35 ms 5728 KB
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        int n, k;
        cin >> n >> k;
        if (k == 1) {
            int klasy[n];
            int suma = 0;
            for (int x = 0; x< n; x++) {
                cin >> klasy[x];
                suma += klasy[x];
            }
            if (suma % 2 == 0) {
                cout << "0";
            }
            else {
                cout << "1";
            }
        }
        else {
            int log = 0;
            while ((1 << log) < k) {
                log++;
            }
            if ((1 << log) > k) {
                log--;
            }
            int klasy[n];
            long long potegi[n][log + 1];
            for (int x = 0; x < n; x++) {
                cin >> klasy[x];
                for (int l = 0; l < log + 1; l++) {
                    potegi[x][l] = klasy[x]/(1 << l);
                }
            }
            long long suma;
            bool czy = true;
            for (int l = 0; l < log + 1; l++) {
                suma = 0;
                for (int x = 0; x < n; x++) {
                    suma += potegi[x][l];
                }
                if (suma % 2 == 1) {
                    cout << "1";
                    czy = false;
                    break;
                }
            }
            if (czy) {
                cout << "0";
            }
    }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 9 ms 344 KB Output is correct
4 Correct 8 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 6 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 344 KB Output is correct
2 Correct 16 ms 344 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 512 KB Output is correct
2 Correct 35 ms 344 KB Output is correct
3 Correct 32 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 600 KB Output is correct
2 Correct 9 ms 1812 KB Output is correct
3 Correct 9 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 4184 KB Output is correct
2 Correct 14 ms 3160 KB Output is correct
3 Correct 23 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 4440 KB Output is correct
2 Correct 26 ms 5728 KB Output is correct