{"problem":{"name":"+/- Rectangle","description":{"content":"You are given four integers: $H$, $W$, $h$ and $w$ ($1 ≤ h ≤ H$, $1 ≤ w ≤ W$). Determine whether there exists a matrix such that all of the following conditions are held, and construct one such matrix","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc016_c"},"statements":[{"statement_type":"Markdown","content":"You are given four integers: $H$, $W$, $h$ and $w$ ($1 ≤ h ≤ H$, $1 ≤ w ≤ W$). Determine whether there exists a matrix such that all of the following conditions are held, and construct one such matrix if the answer is positive:\n\n*   The matrix has $H$ rows and $W$ columns.\n*   Each element of the matrix is an integer between $-10^9$ and $10^9$ (inclusive).\n*   The sum of all the elements of the matrix is positive.\n*   The sum of all the elements within every subrectangle with $h$ rows and $w$ columns in the matrix is negative.\n\n## Constraints\n\n*   $1 ≤ h ≤ H ≤ 500$\n*   $1 ≤ w ≤ W ≤ 500$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$ $h$ $w$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc016_c","tags":[],"sample_group":[["3 3 2 2","Yes\n1 1 1\n1 -4 1\n1 1 1\n\nThe sum of all the elements of this matrix is $4$, which is positive. Also, in this matrix, there are four subrectangles with $2$ rows and $2$ columns as shown below. For each of them, the sum of all the elements inside is $-1$, which is negative.\n\n![image](https://atcoder.jp/img/agc016/bbdb651fa1f05996886da9f0c4d8090a.png)"],["2 4 1 2","No"],["3 4 2 3","Yes\n2 -5 8 7\n3 -5 -4 -5\n2 1 -1 7"]],"created_at":"2026-03-03 11:01:13"}}