{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\u003ci\u003eN\u003c/i\u003e children are sitting in a circle to play a game.\u003c/p\u003e\u003cp\u003eThe children are numbered from 1 to \u003ci\u003eN\u003c/i\u003e in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The game starts from the \u003ci\u003eK\u003c/i\u003e-th child, who tells all the others the integer on his card and jumps out of the circle. The integer on his card tells the next child to jump out. Let \u003ci\u003eA\u003c/i\u003e denote the integer. If \u003ci\u003eA\u003c/i\u003e is positive, the next child will be the \u003ci\u003eA\u003c/i\u003e-th child to the left. If \u003ci\u003eA\u003c/i\u003e is negative, the next child will be the (\u003cspan lang\u003d\"en-us\"\u003e−\u003c/span\u003e\u003ci\u003eA\u003c/i\u003e)-th child to the right.\u003c/p\u003e\u003cp\u003eThe game lasts until all children have jumped out of the circle. During the game, the \u003ci\u003ep\u003c/i\u003e-th child jumping out will get \u003ci\u003eF\u003c/i\u003e(\u003ci\u003ep\u003c/i\u003e) candies where \u003ci\u003eF\u003c/i\u003e(\u003ci\u003ep\u003c/i\u003e) is the number of positive integers that perfectly divide \u003ci\u003ep\u003c/i\u003e. Who gets the most candies?\u003c/p\u003e\n给定人数n,及他们的名字和卡片值,这n个人顺时针围成圈进行一场游戏,从第k个人开始,这个人出圈,并根据他的卡片值A来确定下一个出圈的人,正值为她顺时针的第A个人,负为逆时针的第-A个人。并根据出圈顺序来确定每人得到的糖数,假设Saber第x个出圈,那么Saber得到的糖果数为x的因子数。求该游戏中获得糖果最多的人和他获得的数量,如果存在多个最大值,则输出最先出圈的。\n"}},{"title":"Input","value":{"format":"HTML","content":"There are several test cases in the input. Each test case starts with two integers \u003ci\u003eN\u003c/i\u003e (0 \u0026lt; \u003ci\u003eN\u003c/i\u003e \u003cspan lang\u003d\"en-us\"\u003e≤ 500,000) and \u003ci\u003eK\u003c/i\u003e (1 ≤ \u003ci\u003eK\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e) on the first line. The next \u003ci\u003eN\u003c/i\u003e lines contains the names of the children (consisting of at most 10 letters) and the integers (non-zero with magnitudes within 10\u003csup\u003e8\u003c/sup\u003e) on their cards in increasing order of the children’\u003c/span\u003es numbers, a name and an integer separated by a single space in a line with no leading or trailing spaces.\n\u003cbr\u003e\n多组样例\n\u003cbr\u003e\n第一行,n, k, 接下来n行,每行一个人的名字,和其卡片值。"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOutput one line for each test case containing the name of the luckiest child and the number of candies he/she gets. If ties occur, always choose the child who jumps out of the circle first.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 2\nTom 2\nJack 4\nMary -1\nSam 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eSam 3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}