{"task": {"agent_timeout": 600, "task": "1212", "verifier_timeout": 7200, "instruction": "Please implement a Python 3 solution to the below problem.\nReason through the problem and:\n1. Restate the problem in plain English\n2. Conceptualize a solution first in plain English\n3. Write a pseudocode solution\n4. Save your solution as solution.py\nNo outside libraries are allowed.\n\n[BEGIN PROBLEM]\nAfter her previous\nartwork was met with critical acclaim, Bessie was offered a job designing\npainting sets. She designs these paintings by choosing $1\\le N\\le 10^5$\naxis-aligned rectangles in the plane such that no two edges are collinear. The\nboundaries of these rectangles define the boundaries of the painting's colored\nregions.\n\nStill being an avant-garde artist, Bessie decides that the painting should\nresemble a Holstein cow. More specifically, each region formed by the rectangles\nis colored either black or white, no two adjacent regions have the same color,\nand the region outside of all the rectangles is colored white.\n\nAfter choosing the rectangles, Bessie would like you to output one of two things\nbased on a parameter $T$:\nIf $T=1$, output the total number of regions.If $T=2$, output the number of white regions followed by the number of black\nregions.\n**Note: the time limit for this problem is 4s, twice the default.**\nINPUT FORMAT (input arrives from the terminal / stdin):\nThe first line contains $N$ and $T$.\n\nThe next $N$ lines each contain the description of a rectangle in the form\n$(x_1,y_1), (x_2,y_2)$ where $1\\le x_1<x_2\\le 2N$ and $1\\le y_1<y_2\\le 2N$.\n$(x_1, y_1)$ and $(x_2, y_2)$ are the bottom left and top right corners of the\nrectangle respectively.\n\nIt is guaranteed that all the $x_i$ form a permutation of $1\\ldots 2N$, and the\nsame holds for all the $y_i$.\n\nOUTPUT FORMAT (print output to the terminal / stdout):\nA single integer if $T=1$, otherwise two separated by spaces.\n\nSAMPLE INPUT:\n2 1\n1 1 3 3\n2 2 4 4\nSAMPLE OUTPUT: \n4\n\nThere are two white regions and two black regions, for a total of four regions.\nThe boundaries of all rectangles are connected, so this input would satisfy the\nconditions of subtask 3.\n\n\nSAMPLE INPUT:\n5 2\n1 5 3 6\n5 4 7 9\n4 1 8 3\n9 8 10 10\n2 2 6 7\nSAMPLE OUTPUT: \n4 5\n\nThe boundary of the rectangle in the upper-right is not connected to the rest of\nthe boundaries, so this input would not satisfy the conditions of subtask 4.\n\n\nSCORING:\nTest cases 3-4 satisfy $N\\le 10^3$.In test cases 5-7, no two rectangle boundaries intersect.In test cases 8-10, $T=1$ and the boundaries of all rectangles are\nconnected.In test cases 11-13, $T=2$ and the boundaries of all rectangles are\nconnected.In test cases 14-18, $T=1$.In test cases 19-23, $T=2$.\n\n\nProblem credits: Andi Qu\n\n[END PROBLEM]\n", "memory": "2048m", "runnable": false, "difficulty": "medium", "language": "", "cpus": 1, "instruction_truncated": false, "category": "python_programming", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "usaco", "tags": ["python", "programming", "usaco"]}, "runs": []}