{"problem":{"name":"No Permutations","description":{"content":"You are given a positive integer $N$. Print the number, modulo $998244353$, of sequences $A$ of length $3N$ that contain each integer from $1$ through $N$ three times and satisfy the following conditi","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":8000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc064_f"},"statements":[{"statement_type":"Markdown","content":"You are given a positive integer $N$. Print the number, modulo $998244353$, of sequences $A$ of length $3N$ that contain each integer from $1$ through $N$ three times and satisfy the following condition.\n\n*   $A$ has no contiguous subsequence of length $N$ that is a permutation of the sequence $(1, 2, \\ldots, N)$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc064_f","tags":[],"sample_group":[["3","132\n\nFor instance, $A = (1, 3, 3, 2, 2, 2, 1, 1, 3)$ satisfies the condition in the problem statement. On the other hand, $A = (1, 3, 3, 2, 2, 3, 1, 1, 2)$ does not, because the $5$\\-th, $6$\\-th, $7$\\-th elements of $A$ form a contiguous subsequence that is a permutation of the sequence $(1, 2, 3)$."],["123456","31984851"]],"created_at":"2026-03-03 11:01:14"}}