{"task": {"agent_timeout": 600, "task": "412", "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]\nProblem 1: Reordering the Cows [Brian Dean, 2014]\n\nFarmer John's N cows (1 <= N <= 100), conveniently numbered 1..N, are\nstanding in a row.  Their ordering is described by an array A, where A(i)\nis the number of the cow in position i.  Farmer John wants to rearrange\nthem into a different ordering for a group photo, described by an array B,\nwhere B(i) is the number of the cow that should end up in position i.\n\nFor example, suppose the cows start out ordered as follows:\n\nA = 5 1 4 2 3\n\nand suppose Farmer John would like them instead to be ordered like this:\n\nB = 2 5 3 1 4\n\nTo re-arrange themselves from the \"A\" ordering to the \"B\" ordering, the\ncows perform a number of \"cyclic\" shifts.  Each of these cyclic shifts\nbegins with a cow moving to her proper location in the \"B\" ordering,\ndisplacing another cow, who then moves to her proper location, displacing\nanother cow, and so on, until eventually a cow ends up in the position\ninitially occupied by the first cow on the cycle.  For example, in the\nordering above, if we start a cycle with cow 5, then cow 5 would move to\nposition 2, displacing cow 1, who moves to position 4, displacing cow 2,\nwho moves to position 1, ending the cycle.  The cows keep performing cyclic\nshifts until every cow eventually ends up in her proper location in the \"B\"\nordering.  Observe that each cow participates in exactly one cyclic shift,\nunless she occupies the same position in the \"A\" and \"B\" orderings.\n\nPlease compute the number of different cyclic shifts, as well as the length\nof the longest cyclic shift, as the cows rearrange themselves.\n\nPROBLEM NAME: reorder\n\nINPUT FORMAT:\n\n* Line 1: The integer N.\n\n* Lines 2..1+N: Line i+1 contains the integer A(i).\n\n* Lines 2+N..1+2N: Line 1+N+i contains the integer B(i).\n\nSAMPLE INPUT:\n\n5\n5\n1\n4\n2\n3\n2\n5\n3\n1\n4\n\nOUTPUT FORMAT:\n\n* Line 1: Two space-separated integers, the first giving the number of\n        cyclic shifts and the second giving the number cows involved\n        in the longest such shift.  If there are no cyclic shifts,\n        output -1 for the second number.\n\nSAMPLE OUTPUT:\n\n2 3\n\nOUTPUT DETAILS:\n\nThere are two cyclic shifts, one involving cows 5, 1, and 2, and the other\ninvolving cows 3 and 4.\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": []}