diff --git a/LibreOJ/6256/6256.cpp b/LibreOJ/6256/6256.cpp new file mode 100644 index 00000000..034e3587 --- /dev/null +++ b/LibreOJ/6256/6256.cpp @@ -0,0 +1,49 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 505; + +int n, m, t, a[N][N], s[N][N]; +bool g[N][N]; + +int sum(int x1, int y1, int x2, int y2) { + return s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1]; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m >> t; + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= m; j++) { + cin >> a[i][j]; + } + } + + for (int i = 1; i < n; i++) { + for (int j = 1; j < m; j++) { + g[i][j] = a[i][j] + a[i + 1][j + 1] == a[i + 1][j] + a[i][j + 1]; + } + } + + for (int i = 1; i < n; i++) { + for (int j = 1; j < m; j++) { + s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + g[i][j]; + } + } + + while (t--) { + int x, y, k; + + cin >> x >> y >> k; + + cout << (k == 1 || sum(x, y, x + k - 2, y + k - 2) == (k - 1) * (k - 1) ? 'Y' : 'N') << endl; + } + + return 0; +} diff --git a/LibreOJ/6256/data/1.ans b/LibreOJ/6256/data/1.ans new file mode 100644 index 00000000..9381d69b --- /dev/null +++ b/LibreOJ/6256/data/1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f8ce3bdbac64c46e1b5bf29ef0b208ce159f1753c48715b060caf8432f5d20b +size 10 diff --git a/LibreOJ/6256/data/1.in b/LibreOJ/6256/data/1.in new file mode 100644 index 00000000..19f4f08f --- /dev/null +++ b/LibreOJ/6256/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf287d9c481fd146b54728ff2a7a214c6064ec4d41b8156c7891205b4ec9aff8 +size 282 diff --git a/LibreOJ/6256/data/10.ans b/LibreOJ/6256/data/10.ans new file mode 100644 index 00000000..ff51c623 --- /dev/null +++ b/LibreOJ/6256/data/10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1035e5d04d297f188d98c128cdbf14de803e2162f492a3305abeb5968d016d01 +size 200000 diff --git a/LibreOJ/6256/data/10.in b/LibreOJ/6256/data/10.in new file mode 100644 index 00000000..70b1c8ed --- /dev/null +++ b/LibreOJ/6256/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1161ffb5a9e069862eee864874e6a1f79509f3b8c4c98f2b0f98cdfe4f510bdd +size 3549793 diff --git a/LibreOJ/6256/data/2.ans b/LibreOJ/6256/data/2.ans new file mode 100644 index 00000000..710e2fb5 --- /dev/null +++ b/LibreOJ/6256/data/2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad2751693d9521e2ffaf38c4c41c60e2b608c8d8569896c6ce5d6c50f38b9719 +size 40 diff --git a/LibreOJ/6256/data/2.in b/LibreOJ/6256/data/2.in new file mode 100644 index 00000000..fbb9bc46 --- /dev/null +++ b/LibreOJ/6256/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:508141be0e823fd341b11c56f9fa985a021a4e7bf839b0705c6b8c5bf6c6e774 +size 99553 diff --git a/LibreOJ/6256/data/3.ans b/LibreOJ/6256/data/3.ans new file mode 100644 index 00000000..993adaf2 --- /dev/null +++ b/LibreOJ/6256/data/3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e87fe02873a53bea3952c926c2e9047698d02152d50ccaa0ad240ba53bda389 +size 40 diff --git a/LibreOJ/6256/data/3.in b/LibreOJ/6256/data/3.in new file mode 100644 index 00000000..b168b4b5 --- /dev/null +++ b/LibreOJ/6256/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:969eeca5237e74417d61432a3f778eb89a276e9312c7986d28ac4baf962592db +size 99693 diff --git a/LibreOJ/6256/data/4.ans b/LibreOJ/6256/data/4.ans new file mode 100644 index 00000000..2bd62301 --- /dev/null +++ b/LibreOJ/6256/data/4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d2d40e9bbe8f6559c4de1f4f2f651aaacf88f2213d4f9db038cb73a1544e64f +size 40 diff --git a/LibreOJ/6256/data/4.in b/LibreOJ/6256/data/4.in new file mode 100644 index 00000000..9486e5bd --- /dev/null +++ b/LibreOJ/6256/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a81b5c26f820616fd5e04a5ddb79d208dde6e6e7e2d28bdf8927de975bccb80 +size 99697 diff --git a/LibreOJ/6256/data/5.ans b/LibreOJ/6256/data/5.ans new file mode 100644 index 00000000..785d35fd --- /dev/null +++ b/LibreOJ/6256/data/5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea484fa64924838095cb2293a7dec22958342b7e218b5f65d4af36652c80a12e +size 40 diff --git a/LibreOJ/6256/data/5.in b/LibreOJ/6256/data/5.in new file mode 100644 index 00000000..2bee61f3 --- /dev/null +++ b/LibreOJ/6256/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc6ae63b02175645254de195eba52bb172850ebf616ae9f98c0d76d94ac3868e +size 2483721 diff --git a/LibreOJ/6256/data/6.ans b/LibreOJ/6256/data/6.ans new file mode 100644 index 00000000..0259d5aa --- /dev/null +++ b/LibreOJ/6256/data/6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04ed05d4bf39aec8225c5da32d5154cdd1b6541f6cab82c74c1b800f54f58b28 +size 40 diff --git a/LibreOJ/6256/data/6.in b/LibreOJ/6256/data/6.in new file mode 100644 index 00000000..14a44097 --- /dev/null +++ b/LibreOJ/6256/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d664790c881b5bc015d1892ac56a8c66bbc080dfba6d010e1f4eedf66b6ad2cc +size 2488564 diff --git a/LibreOJ/6256/data/7.ans b/LibreOJ/6256/data/7.ans new file mode 100644 index 00000000..1c633a93 --- /dev/null +++ b/LibreOJ/6256/data/7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9459013256cb6d75a33bc19bce7451dba0de16522ad64c9477098622d59944c3 +size 200000 diff --git a/LibreOJ/6256/data/7.in b/LibreOJ/6256/data/7.in new file mode 100644 index 00000000..a5f6c67a --- /dev/null +++ b/LibreOJ/6256/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb346ae1a47828508606edc25bac92d89c460266acf611cb83bfc6c79e096247 +size 3533476 diff --git a/LibreOJ/6256/data/8.ans b/LibreOJ/6256/data/8.ans new file mode 100644 index 00000000..b515db3c --- /dev/null +++ b/LibreOJ/6256/data/8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bdb36a05386a0234ee1ea6fb226ff0e54dc5169f2973e3260b485d5b0ae8cf7 +size 200000 diff --git a/LibreOJ/6256/data/8.in b/LibreOJ/6256/data/8.in new file mode 100644 index 00000000..85c7cf60 --- /dev/null +++ b/LibreOJ/6256/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3191c39128e08e49326c0bfa2e516ebf0ad47325abc4cd9298cbfcb6f1706fe +size 3549660 diff --git a/LibreOJ/6256/data/9.ans b/LibreOJ/6256/data/9.ans new file mode 100644 index 00000000..571804b7 --- /dev/null +++ b/LibreOJ/6256/data/9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7790d928f4089c9a1d98c8a4ef83d0e7b3d5e66b690906d04320a8e4936cbcb +size 200000 diff --git a/LibreOJ/6256/data/9.in b/LibreOJ/6256/data/9.in new file mode 100644 index 00000000..f8f53459 --- /dev/null +++ b/LibreOJ/6256/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b9dea518c50c89735cc66ceaf386d0f9e11b8404bc24749b7ded8fa5b567a05 +size 3551076