{"problem":{"name":"Divide String","description":{"content":"You are given a string $S$ of length $N$ consisting of lowercase English letters. Determine whether it is possible to divide $S$ into two or more consecutive substrings so that they are strictly incre","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc163_a"},"statements":[{"statement_type":"Markdown","content":"You are given a string $S$ of length $N$ consisting of lowercase English letters. Determine whether it is possible to divide $S$ into two or more consecutive substrings so that they are strictly increasing in lexicographical order.\nTo be precise, determine whether there is a sequence of strings $t=(t_1,t_2,\\dots,t_k)$ that satisfies all of the following conditions.\n\n*   The length of the sequence $k$ is at least $2$.\n    \n*   $t_i$ is not empty. ($1 \\le i \\le k$)\n    \n*   Concatenating $t_1,t_2,\\dots,t_k$ in this order results in $S$.\n    \n*   $t_i$ is lexicographically smaller than $t_{i+1}$ for every integer $i$ such that $1 \\le i < k$.\n    \n\nYou are given $T$ test cases. Find the answer for each of them.\nWhat is lexicographical order?A string $S = S_1S_2\\ldots S_{|S|}$ is said to be **lexicographically smaller** than a string $T = T_1T_2\\ldots T_{|T|}$ if either 1. or 2. below holds. Here, $|S|$ and $|T|$ represent the lengths of $S$ and $T$, respectively.\n\n1.  $|S| \\lt |T|$ and $S_1S_2\\ldots S_{|S|} = T_1T_2\\ldots T_{|S|}$.\n2.  There is an integer $1 \\leq i \\leq \\min\\lbrace |S|, |T| \\rbrace$ such that both of the following hold.\n    *   $S_1S_2\\ldots S_{i-1} = T_1T_2\\ldots T_{i-1}$.\n    *   The character $S_i$ comes before $T_i$ in alphabetical order.\n\n## Constraints\n\n*   $1 \\le T \\le 2000$\n*   $2 \\le N \\le 2000$\n*   $S$ is a string of length $N$ consisting of lowercase English letters.\n*   The sum of $N$ over all test cases in a single input does not exceed $2000$.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$T$\n$\\mathrm{case}_1$\n$\\mathrm{case}_2$\n$\\vdots$\n$\\mathrm{case}_T$\n\nHere, $\\mathrm{case}_i$ represents the $i$\\-th test case. Each test case is given in the following format:\n\n$N$\n$S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc163_a","tags":[],"sample_group":[["5\n4\nabac\n3\ncac\n2\nab\n12\nabababababab\n5\nedcba","Yes\nNo\nYes\nYes\nNo\n\nFor the first test case, you can divide $S$ into `a`, `ba`, `c`.\nFor the second test case, there is no way to divide $S$ into substrings so that they are strictly increasing in lexicographical order."]],"created_at":"2026-03-03 11:01:13"}}