{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \u003cp\u003e\u003ci\u003eN\u003c/i\u003e children are sitting in a circle to play a game.\u003c/p\u003e\n \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\n \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 \u003c/div\u003e\n\n\n\u003cp\u003e题目翻译:\u003c/p\u003e\n\u003cp\u003e刘学姐有 n 件女装,她每天早上都非常纠结究竟要穿那套去迎接新的一天,有一天她觉得每天都纠结穿哪套实在太麻烦了,于是他把她在每一套女装上都写了一个数字 a(i),他每天根据以下规则决定穿哪套去上课,她把她的女装按照顺序顺时针围成一个圈,首先她想出一个数字 k ,表示她要从第 k 套开始此规则,她将该女装丢到圈外,然后根据该女装上的数字 a(k),若为正数则顺时针数到第 a(k) 套女装,否则逆时针数到第 -a(k) 套女装,再从数到的那套女装开始上述规则,直到所有女装都被丢出圈外,第 j 套被丢出圈的女装的魅力指数是 F(j),F(j) 是能够整除 j 的正整数的个数,现在刘学姐要选一件魅力指数最大的女装来迎接美丽的一天,刘学姐算数很烂,所以她想请你帮你选出魅力指数最高的女装。\u003c/p\u003e\n\n\u003cp\u003eInput\u003c/p\u003e\n\u003cp\u003e\n输入包含几组测试样例。每组测试数据第一行包括两个整数 n ( 0 \u003c n \u003c\u003d 500,000 )和k ( 1 \u003c\u003d k \u003c\u003d n ),接下来的 n 行,每一行为每件女装的名称(名称不会超过十个字符)和这件女装上面标注的数字a(i) ( 0 \u003c a(i) \u003c\u003d 1e8 )。\n\u003c/p\u003e\n\u003cp\u003eOutput\u003c/p\u003e\n\u003cp\u003e每组测试样例输出一行,包括魅力指数最高的女装和该女装的魅力指数。\u003c/p\u003e\n\u003cp\u003e如果有多套魅力指数最高的,输出其中最早出圈的女装。\u003c/p\u003e\n\n\u003cp\u003eSample Input\u003c/p\u003e\n\u003cp\u003e4 2\u003c/p\u003e\n\u003cp\u003eLovely 2\u003c/p\u003e\n\u003cp\u003ePretty 4\u003c/p\u003e\n\u003cp\u003eMature -1\u003c/p\u003e\n\u003cp\u003eSexy 1\u003c/p\u003e\n\n\u003cp\u003eSample Output\u003c/p\u003e\n\u003cp\u003eSexy 3\u003c/p\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n There are several test cases in the input. Each test case starts with two integers \n \u003ci\u003eN\u003c/i\u003e (0 \u0026lt; \n \u003ci\u003eN\u003c/i\u003e \n \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 \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n \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\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4 2\nTom 2\nJack 4\nMary -1\nSam 1\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003eSam 3\u003c/pre\u003e\n"}}]}