{"problem":{"name":"01 Matrix Again","description":{"content":"There is an $N \\times N$ grid. Let $(i, j)$ denote the cell at the $i$\\-th row from the top and the $j$\\-th column from the left. You are to fill each cell with $0$ or $1$. Construct one method to fil","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":4000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc176_a"},"statements":[{"statement_type":"Markdown","content":"There is an $N \\times N$ grid. Let $(i, j)$ denote the cell at the $i$\\-th row from the top and the $j$\\-th column from the left.\nYou are to fill each cell with $0$ or $1$. Construct one method to fill the grid that satisfies all of the following conditions:\n\n*   The cells $(A_1,B_1), (A_2,B_2), \\dots, (A_M,B_M)$ contain $1$.\n*   The integers in the $i$\\-th row sum to $M$. $(1 \\le i \\le N)$\n*   The integers in the $i$\\-th column sum to $M$. $(1 \\le i \\le N)$\n\nIt can be proved that under the constraints of this problem, there is at least one method to fill the grid that satisfies the conditions.\n\n## Constraints\n\n*   $1 \\le N \\le 10^5$\n*   $1 \\le M \\le \\min(N,10)$\n*   $1 \\le A_i, B_i \\le N$\n*   $(A_i, B_i) \\neq (A_j, B_j)$ if $i \\neq j$.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_{M}$ $B_{M}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc176_a","tags":[],"sample_group":[["4 2\n1 4\n3 2","8\n1 2\n1 4\n2 1\n2 4\n3 2\n3 3\n4 1\n4 3\n\nThis output fills the grid as follows. All the conditions are satisfied, so this output is correct.\n\n0101\n1001\n0110\n1010"],["3 3\n3 1\n2 3\n1 3","9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"],["7 3\n1 7\n7 6\n6 1","21\n1 6\n2 4\n4 1\n7 3\n3 6\n4 5\n6 1\n1 7\n7 6\n3 5\n2 2\n6 3\n6 7\n5 4\n5 2\n2 5\n5 3\n1 4\n7 1\n4 7\n3 2"]],"created_at":"2026-03-03 11:01:13"}}