{"problem":{"name":"Not Argmax","description":{"content":"Find the number, modulo $998244353$, of permutations $P=(P_1,P_2,\\cdots,P_N)$ of $(1,2,\\cdots,N)$ that satisfy all of the following $M$ conditions. *   The $i$\\-th condition: The maximum among $P_{L_","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc183_c"},"statements":[{"statement_type":"Markdown","content":"Find the number, modulo $998244353$, of permutations $P=(P_1,P_2,\\cdots,P_N)$ of $(1,2,\\cdots,N)$ that satisfy all of the following $M$ conditions.\n\n*   The $i$\\-th condition: The maximum among $P_{L_i},P_{L_i+1},\\cdots,P_{R_i}$ is **not** $P_{X_i}$. Here, $L_i$, $R_i$, and $X_i$ are integers given in the input.\n\n## Constraints\n\n*   $1 \\leq N \\leq 500$\n*   $1 \\leq M \\leq 10^5$\n*   $1 \\leq L_i \\leq X_i \\leq R_i \\leq N$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$L_1$ $R_1$ $X_1$\n$L_2$ $R_2$ $X_2$\n$\\vdots$\n$L_M$ $R_M$ $X_M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc183_c","tags":[],"sample_group":[["3 2\n1 3 2\n1 2 1","1\n\nOnly one permutation, $P=(1,2,3)$, satisfies the conditions."],["5 1\n1 1 1","0"],["10 5\n3 8 4\n3 10 4\n1 7 2\n1 8 3\n3 8 7","1598400"],["15 17\n2 11 9\n2 15 13\n1 14 2\n5 11 5\n3 15 11\n1 6 2\n4 15 12\n3 11 6\n9 13 10\n2 14 6\n10 15 11\n1 8 6\n6 14 8\n2 10 2\n6 12 6\n3 14 12\n2 6 2","921467228"]],"created_at":"2026-03-03 11:01:14"}}