Cod sursa(job #3224136)

Utilizator MihneaStoicaMihnea Teodor Stoica MihneaStoica Data 14 aprilie 2024 19:57:53
Problema Xerox Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 2.16 kb
/// Code by MihneaTheMogger

#include <bits/stdc++.h>
#include <unistd.h>

using namespace std;

template<typename T>
void ReadInt (T& a)
{
    char mul = 1, c;
    a = 0;
    while ( (c = fgetc (stdin)) == ' ' || c == '\t' || c == '\n' || c == '\r');
    if (c == '-')
        mul = -1, c = fgetc (stdin);
    while (48 <= c && c <= 57)
    {
        a = a * 10 + c - 48;
        c = fgetc (stdin);
    }
    a *= mul;
    ungetc (c, stdin);
}

template<typename T>
void PrintInt (const T num)
{
    char buf[32];
    int len = sprintf (buf, "%d", num);
    write (STDOUT_FILENO, buf, len);
}

template<typename T>
void PrintIntLn (const T num)
{
    char buf[32];
    int len = sprintf (buf, "%d\n", num);
    write (STDOUT_FILENO, buf, len);
}

///---------------------------------------------------------------------------->

#define int int64_t

void preinit()
{
}

void solve()
{
    int n, dx, dy;
    ReadInt(n);
    ReadInt(dx);
    ReadInt(dy);

    int ok = 0;
    for (int i = 1; i <= n; i ++)
    {
        int a; ReadInt(a);
        for (int j = 1; j <= a; j ++) {int x; ReadInt(x); ReadInt(x);}

        ok ^= a;
    }

    if (ok)
    {
        PrintIntLn(1);
    }
    else PrintIntLn(0);
}

/**

*/

///---------------------------------------------------------------------------->

#ifdef int
#undef int
#endif

namespace IO
{
struct IO_DATA
{
    void setio();

    const string filein, fileout;
    bool use_fastio;
};

bool multiple_testcases = 1;
IO_DATA         _ONLINE = {"xerox.in", "xerox.out", 1},
                _LOCAL  = {"", "", 1};
}

void IO::IO_DATA::setio()
{
    if (use_fastio)
    {
        ios_base::sync_with_stdio (false);
        cin.tie (NULL);
        cout.tie (NULL);
    }
    if (!filein.empty())
        freopen (filein.c_str(), "r", stdin);
    if (!fileout.empty())
        freopen (fileout.c_str(), "w", stdout);
}

int main()
{
#ifndef LOCAL
    IO::_ONLINE.setio();
#else
    IO::_LOCAL.setio();
#endif
    int t = 1;
    preinit();
    if (IO::multiple_testcases)
        ReadInt(t);
    while (t --)
        solve();
    return 0;
}