diff --git a/LibreOJ/134/134.cpp b/LibreOJ/134/134.cpp new file mode 100644 index 00000000..93d692f9 --- /dev/null +++ b/LibreOJ/134/134.cpp @@ -0,0 +1,66 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = (1 << 12) + 5; + +int n, m, op; +long long c[N][N]; + +int lowbit(int x) { + return x & -x; +} + +void add(int x, int y, int v) { + for (int i = x; i <= n; i += lowbit(i)) { + for (int j = y; j <= m; j += lowbit(j)) { + c[i][j] += v; + } + } +} + +void add(int x1, int y1, int x2, int y2, int v) { + add(x1, y1, v); + add(x1, y2 + 1, -v); + add(x2 + 1, y1, -v); + add(x2 + 1, y2 + 1, v); +} + +long long sum(int x, int y) { + long long res = 0; + + for (int i = x; i; i -= lowbit(i)) { + for (int j = y; j; j -= lowbit(j)) { + res += c[i][j]; + } + } + + return res; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m; + + while (cin >> op) { + if (op == 1) { + int a, b, c, d, k; + + cin >> a >> b >> c >> d >> k; + + add(a, b, c, d, k); + } else { // op == 2 + int x, y; + + cin >> x >> y; + + cout << sum(x, y) << endl; + } + } + + return 0; +} diff --git a/LibreOJ/134/data/0.in b/LibreOJ/134/data/0.in new file mode 100644 index 00000000..4d63a6ed --- /dev/null +++ b/LibreOJ/134/data/0.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:302d2fffecccc61508af25b0e530efee1ebe708e9a39cee34fde6cb5462244fa +size 60 diff --git a/LibreOJ/134/data/0.out b/LibreOJ/134/data/0.out new file mode 100644 index 00000000..bd88e508 --- /dev/null +++ b/LibreOJ/134/data/0.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b33442c7846900b16c229ad7cc2636c78896b009137fb4adff3ff9aa64f6f7 +size 12 diff --git a/LibreOJ/134/data/1.in b/LibreOJ/134/data/1.in new file mode 100644 index 00000000..2f566efc --- /dev/null +++ b/LibreOJ/134/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad41bdb7e5ad2f6709fb213eeb9b7611a9ae1f05ccbcce56689cba4ac4f93f31 +size 4889517 diff --git a/LibreOJ/134/data/1.out b/LibreOJ/134/data/1.out new file mode 100644 index 00000000..cba0cf50 --- /dev/null +++ b/LibreOJ/134/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54dbc54b6a33b9578b4f7fc23b637b85b3d3d0f2d1bafb60e51eaa13e4487e3f +size 1523735 diff --git a/LibreOJ/134/data/10.in b/LibreOJ/134/data/10.in new file mode 100644 index 00000000..eda1643e --- /dev/null +++ b/LibreOJ/134/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:006d97c34812f9e381645ee5cd4beb09afd6b7db02525e510d76177b49ec5dda +size 6089872 diff --git a/LibreOJ/134/data/10.out b/LibreOJ/134/data/10.out new file mode 100644 index 00000000..bc255038 --- /dev/null +++ b/LibreOJ/134/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecf389f0ee30a01006e746de23570dee877702af8fc0f34d8c9cefefc9329729 +size 1156747 diff --git a/LibreOJ/134/data/11.in b/LibreOJ/134/data/11.in new file mode 100644 index 00000000..7c27783c --- /dev/null +++ b/LibreOJ/134/data/11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:038463c6b73ee01be841543e34b34aaf40daa5f919c0f9fb880e8e656606f548 +size 5641159 diff --git a/LibreOJ/134/data/11.out b/LibreOJ/134/data/11.out new file mode 100644 index 00000000..f289a08f --- /dev/null +++ b/LibreOJ/134/data/11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae6eec389c6959298bf058935de43f3851f95ba3f81a3922fcca5326b53a37c0 +size 1141768 diff --git a/LibreOJ/134/data/12.in b/LibreOJ/134/data/12.in new file mode 100644 index 00000000..fc654e84 --- /dev/null +++ b/LibreOJ/134/data/12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43a0458d7a6201066e1a6af6438399247886efc8583cf76e18bf666972dd894b +size 6081436 diff --git a/LibreOJ/134/data/12.out b/LibreOJ/134/data/12.out new file mode 100644 index 00000000..50246002 --- /dev/null +++ b/LibreOJ/134/data/12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e265804d412279bdfde36f1b211781ae70eb7e9a8e7fbf7818cb8085f956bb5 +size 1197522 diff --git a/LibreOJ/134/data/13.in b/LibreOJ/134/data/13.in new file mode 100644 index 00000000..cd44e767 --- /dev/null +++ b/LibreOJ/134/data/13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6957241852021e4df18414819d47ab60e76b843a5994444cfbd2cf08a5dfcf72 +size 4938733 diff --git a/LibreOJ/134/data/13.out b/LibreOJ/134/data/13.out new file mode 100644 index 00000000..d549c689 --- /dev/null +++ b/LibreOJ/134/data/13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:674d1711f9a514c84da20b95aabd6df25f87eda636fc738eb4b6e5663ffd32fd +size 1773275 diff --git a/LibreOJ/134/data/14.in b/LibreOJ/134/data/14.in new file mode 100644 index 00000000..16efeacf --- /dev/null +++ b/LibreOJ/134/data/14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56bd3d982401bc1c6c6929e6e6984135d2ef5617b592398fea6ce701c4d9ab15 +size 6023433 diff --git a/LibreOJ/134/data/14.out b/LibreOJ/134/data/14.out new file mode 100644 index 00000000..4e5c2fff --- /dev/null +++ b/LibreOJ/134/data/14.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac7b7d2a2f2912fb9c2c64f36b36b19d32ed405c959b56cbac510ff36edd752c +size 1082869 diff --git a/LibreOJ/134/data/15.in b/LibreOJ/134/data/15.in new file mode 100644 index 00000000..0cee4d66 --- /dev/null +++ b/LibreOJ/134/data/15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3646fcea6834a77afc43f1cb7adde29cd021b04c45f26b01f9d16aa71f009668 +size 6004290 diff --git a/LibreOJ/134/data/15.out b/LibreOJ/134/data/15.out new file mode 100644 index 00000000..52431750 --- /dev/null +++ b/LibreOJ/134/data/15.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99e656aa386c8f28401c2952bda309d62d31dbb2cc4262f5d186e827089db9a7 +size 1093854 diff --git a/LibreOJ/134/data/16.in b/LibreOJ/134/data/16.in new file mode 100644 index 00000000..bfad35cd --- /dev/null +++ b/LibreOJ/134/data/16.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbf5292d6aee186030912d9c9e53cd959161c2d72df3accca97eb5f4143003d8 +size 6141549 diff --git a/LibreOJ/134/data/16.out b/LibreOJ/134/data/16.out new file mode 100644 index 00000000..a8b7d46c --- /dev/null +++ b/LibreOJ/134/data/16.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:228f85b1b07ae79aefa8c11f85c0b3d59313e1db2941a7825da6f3c25b04163d +size 1404261 diff --git a/LibreOJ/134/data/17.in b/LibreOJ/134/data/17.in new file mode 100644 index 00000000..af1e6f1c --- /dev/null +++ b/LibreOJ/134/data/17.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c994da2992ab0479d2a0faa53abe2e88fb8b67b1a884ff53a042bae9d60047a +size 6141148 diff --git a/LibreOJ/134/data/17.out b/LibreOJ/134/data/17.out new file mode 100644 index 00000000..43ff7bcf --- /dev/null +++ b/LibreOJ/134/data/17.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac1b15b02592fd0ba85a0b3fa8fa32fd5e17c870c65ff49b90ced95a8f6193e6 +size 1390402 diff --git a/LibreOJ/134/data/18.in b/LibreOJ/134/data/18.in new file mode 100644 index 00000000..7f0a6b37 --- /dev/null +++ b/LibreOJ/134/data/18.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74f941fb096c312bbcc2e4492b8c6445afa941f6f8169f168559d86069386571 +size 6140248 diff --git a/LibreOJ/134/data/18.out b/LibreOJ/134/data/18.out new file mode 100644 index 00000000..229a8f2b --- /dev/null +++ b/LibreOJ/134/data/18.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21e202c075f9782e1acd35daa09ca7fb877c9a340872d9507d84bf20a9fd3df2 +size 1415999 diff --git a/LibreOJ/134/data/19.in b/LibreOJ/134/data/19.in new file mode 100644 index 00000000..d72bb3ba --- /dev/null +++ b/LibreOJ/134/data/19.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6df0b94f59778a7c76d2fe702d4d2ec0e9abe4c7e199ceaf8135e158c466ca40 +size 6127605 diff --git a/LibreOJ/134/data/19.out b/LibreOJ/134/data/19.out new file mode 100644 index 00000000..14d59556 --- /dev/null +++ b/LibreOJ/134/data/19.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b8b7b564614c96af4d8feff1a4a318d26aeda23094a2bad459043810c5f1c30 +size 1186211 diff --git a/LibreOJ/134/data/2.in b/LibreOJ/134/data/2.in new file mode 100644 index 00000000..2d322b26 --- /dev/null +++ b/LibreOJ/134/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:853d477c87ce6fed6e483620174f4cb03ccdec697df6ef949128153c7f2693d9 +size 4889581 diff --git a/LibreOJ/134/data/2.out b/LibreOJ/134/data/2.out new file mode 100644 index 00000000..23f7e2bc --- /dev/null +++ b/LibreOJ/134/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:428774fcc141cecdf79d1d08a2042209fdf28ba2f8d631b3ddf0ad42640769ca +size 1410241 diff --git a/LibreOJ/134/data/20.in b/LibreOJ/134/data/20.in new file mode 100644 index 00000000..ab517dec --- /dev/null +++ b/LibreOJ/134/data/20.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3267392d5d56330711ccfad1eaca6d276e1f3ad0099ae2bae3dc09043f240d6f +size 6126741 diff --git a/LibreOJ/134/data/20.out b/LibreOJ/134/data/20.out new file mode 100644 index 00000000..f2bfe2f1 --- /dev/null +++ b/LibreOJ/134/data/20.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abaa14283b83a82e00b62eaf80837617d1d8e603655f6b93af1e06412c495475 +size 1185263 diff --git a/LibreOJ/134/data/3.in b/LibreOJ/134/data/3.in new file mode 100644 index 00000000..a4a9d069 --- /dev/null +++ b/LibreOJ/134/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bc421892ce3317d9c609fdb5c98c2e74c61a7db8155f5bdcf788d77c7604cc3 +size 6118374 diff --git a/LibreOJ/134/data/3.out b/LibreOJ/134/data/3.out new file mode 100644 index 00000000..f93433ca --- /dev/null +++ b/LibreOJ/134/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:510c53579c1262e299b4524dc2ef385bae86dbfc4a834e0c1e5c3cc6e2e56944 +size 1365565 diff --git a/LibreOJ/134/data/4.in b/LibreOJ/134/data/4.in new file mode 100644 index 00000000..4a2f84e4 --- /dev/null +++ b/LibreOJ/134/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24b212dbe4418c13b8dfd6900aac70d3937a7dc441774174adbffa1178a27e75 +size 8999994 diff --git a/LibreOJ/134/data/4.out b/LibreOJ/134/data/4.out new file mode 100644 index 00000000..021696aa --- /dev/null +++ b/LibreOJ/134/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dba723bd28607b0686b15d8dbe2e91e0850de618c1155ce45aa218f6322cd6aa +size 13 diff --git a/LibreOJ/134/data/5.in b/LibreOJ/134/data/5.in new file mode 100644 index 00000000..f92dc043 --- /dev/null +++ b/LibreOJ/134/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50e08bac6252b5808c787f0a3986a592409be8fc6e22c8fb5b68134769ceaf4a +size 6008886 diff --git a/LibreOJ/134/data/5.out b/LibreOJ/134/data/5.out new file mode 100644 index 00000000..f7bf4017 --- /dev/null +++ b/LibreOJ/134/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e6909200dd90aa49bd362f2426dabab4c12230bed6e37de37e6de04d85ddd23 +size 1474192 diff --git a/LibreOJ/134/data/6.in b/LibreOJ/134/data/6.in new file mode 100644 index 00000000..f98508e2 --- /dev/null +++ b/LibreOJ/134/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d2686534ebc72ee6589749e3c42fbeb3e7228a6d7c4e7d1795bc1ee26870233 +size 6190889 diff --git a/LibreOJ/134/data/6.out b/LibreOJ/134/data/6.out new file mode 100644 index 00000000..dfe06538 --- /dev/null +++ b/LibreOJ/134/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52241b682c3cf6f94036878405409b04ab7778c9b689f8e870c1f616c7fe870a +size 1767292 diff --git a/LibreOJ/134/data/7.in b/LibreOJ/134/data/7.in new file mode 100644 index 00000000..afcb126c --- /dev/null +++ b/LibreOJ/134/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86d158986707234f33c03266a65e4186d208911b6426b2f15425f7a590d5229b +size 5822077 diff --git a/LibreOJ/134/data/7.out b/LibreOJ/134/data/7.out new file mode 100644 index 00000000..07cc2ef0 --- /dev/null +++ b/LibreOJ/134/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:871650ef223e807d195e6e66770d731a8d5997f0cb73475526910d25d06fa088 +size 1862064 diff --git a/LibreOJ/134/data/8.in b/LibreOJ/134/data/8.in new file mode 100644 index 00000000..7f8c00cc --- /dev/null +++ b/LibreOJ/134/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9f060e6c30f7f6846b609e75755b308c44f5e8c280f24495a12973e6671dab7 +size 5672378 diff --git a/LibreOJ/134/data/8.out b/LibreOJ/134/data/8.out new file mode 100644 index 00000000..ae047788 --- /dev/null +++ b/LibreOJ/134/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b3d0d46d15a91448e0392f63dd3a888952970f4d288c859736da4b0a935717c +size 1712533 diff --git a/LibreOJ/134/data/9.in b/LibreOJ/134/data/9.in new file mode 100644 index 00000000..62506c46 --- /dev/null +++ b/LibreOJ/134/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e321cd663f13f137e4fc0c4a6ec8219a071497c192a9bc24bda2409d401a029 +size 5639873 diff --git a/LibreOJ/134/data/9.out b/LibreOJ/134/data/9.out new file mode 100644 index 00000000..4d25f645 --- /dev/null +++ b/LibreOJ/134/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2f670016a3840d7b7c5df159fa605a31f62fb41462ee8f74859d0771c1fc2b7 +size 1110100