Lâmpadas

Problem Link

Solution by TioPatinhas100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int>P;
    int i1 = 0;
    int i2 = 0;
    for (int i = 0; i < n; i++) {
        int Ai;
        cin >> Ai;
        if (Ai == 1) {i1++;}
        if (Ai == 2) {
            i1++;
            i2++;
        }
    }
    if (i1%2 == 0) {cout << '0' << endl;}
    else {cout << '1' << endl;}
    if (i2%2 == 0) {cout << '0' << endl;}
    else {
        cout << '1' << endl;
    }
} 

Last updated 1 week, 3 days ago


« Back to problem