{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"The annual \"Phantom Pavilion Summer Wine Tasting Conference\" has grandly opened. The conference includes two parts: tasting and fun challenges, awarding the titles of \"Chief Taster\" and \"Chief Hunter\" to the winners, attracting many tasters to participate.\n\n\nAt the dinner of the conference, bartender Rainbow prepared $n$ cups of cocktails. These $n$ cups of cocktails are arranged in a row, with the $n$ cup of liquor ($1 ≤ i ≤ n$) labeled with a tag $s_i$. Each tag consists of one of $26$ lowercase English letters. Let $str(l, r)$ represent the string formed by the tags from the $l$ cup to the $r$ cup, concatenated in order. If $str(p, p_0) \u003d str(q, q_0)$, where $1 ≤ p ≤ p_0 ≤ n$, $1 ≤ q ≤ q_0 ≤ n$, $p ≠ q$, $p_0-p+1 \u003d q_0 - q + 1 \u003d r$, then the $p$ cup of liquor is said to be \" $r$ similar\" to the $q$ cup of liquor. Of course, two cups of \" $r$ similar\" ($r \u003e 1$) liquor are also \" $1$ similar\", \" $2$ similar\", ..., \" $(r - 1)$ similar\". In particular, for any $1 ≤ p ,q ≤ n,p ≠ q$, the $p$ cup of liquor and the $q$ cup of liquor are all \" $0$ similar\".\n\n\nDuring the tasting session, taster Freda easily evaluated the deliciousness of each cup of liquor, successfully winning the title of \"Chief Taster\" with her professional standards and experience, with the deliciousness of the $i$ cup of liquor ($1 ≤ i ≤ n$) being $a_i$. Now Rainbow has announced the challenge question: the cocktails prepared for this conference have a characteristic that if the $p$ cup of liquor is mixed with the $q$ cup of liquor, it will result in a cup of liquor with a deliciousness of $a_p\\times a_q$. Now, each taster is asked to count how many ways they can select $2$ cups of \" $r$ similar\" liquor, and to answer the maximum deliciousness that can be obtained by mixing $2$ cups of \" $r$ similar\" liquor."}},{"title":"Input","value":{"format":"MD","content":"The $1$ line contains $1$ positive integers $n$, indicating the number of cups of cocktails.\n\nThe $2$ line contains a string $S$ of length $n$, where the $i$th character represents the tag of the $i$ cup of liquor.\n\nThe $3$ line contains $n$ integers, separated by a single space, where the $i$th integer represents the deliciousness $a_i$ of the $i$ cup of liquor."}},{"title":"Output","value":{"format":"MD","content":"Includes $n$ lines.\n\nThe $i$ line outputs $2$ integers, separated by a single space. The $1$th integer represents the number of ways to select two \" $(i - 1)$ similar\" cups of liquor, and the 2nd integer represents the maximum deliciousness obtainable by mixing two \" $(i - 1)$ similar\" cups of liquor. If there are no two \" $(i - 1)$ similar\" cups of liquor, both numbers are $0$."}},{"title":"Sample 1","value":{"format":"MD","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\u003e10\nponoiiipoi\n2 1 4 7 4 8 3 6 4 7\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e45 56\n10 56\n3 32\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Sample 2","value":{"format":"MD","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\u003e12\nabaabaabaaba\n1 -2 3 -4 5 -6 7 -8 9 -10 11 -12\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e66 120\n34 120\n15 55\n12 40\n9 27\n7 16\n5 7\n3 -4\n2 -4\n1 -4\n0 0\n0 0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"【Sample Explanation 1】\n\nUse the pair $(p, q)$ to represent the $p$ cup of liquor and the $q$ cup of liquor.\n\n$0$ similar: All $45$ pairs of tuples are $0$ similar, with the maximum deliciousness being $8 × 7 \u003d 56 $.\n\n$1$ similar: $(1,8) (2,4) (2,9) (4,9) (5,6) (5,7) (5,10) (6,7) (6,10) (7,10) $, maximum $8 × 7 \u003d 56$.\n\n$2$ similar: $(1,8) (4,9) (5,6)$, maximum $4 × 8 \u003d 32$.\n\nThere are no two cups of $3,4,5, ⋯ ,9$ similar liquor, so both outputs are $0$.\n\n\n\n ![](CDN_BASE_URL/545e79c8e0fa7b95e8b5212a9c5cb6c4?v\u003d1723725367) \n\n【Time limit 1s, Memory 512M】"}}]}