diff --git a/BZOJ/3942/3942.cpp b/BZOJ/3942/3942.cpp new file mode 100644 index 00000000..689d776d --- /dev/null +++ b/BZOJ/3942/3942.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e6 + 5; +const int hash = 233333; + +int cnt; +char st[N]; +std::string s, t; +unsigned long long p = 1, h[N], t_hash; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> s >> t; + + int n = s.size(); + int m = t.size(); + s = ' ' + s; + + for (char c : t) { + t_hash = t_hash * hash + c; + p *= hash; + } + + for (int i = 1; i <= n; i++) { + st[++cnt] = s[i]; + + h[cnt] = h[cnt - 1] * hash + s[i]; + + if (cnt >= m && h[cnt] - h[cnt - m] * p == t_hash) { + cnt -= m; + } + } + + for (int i = 1; i <= cnt; i++) { + cout << st[i]; + } + + cout << endl; + + return 0; +} diff --git a/BZOJ/3942/data/1.in b/BZOJ/3942/data/1.in new file mode 100644 index 00000000..eb673bcd --- /dev/null +++ b/BZOJ/3942/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:661c92ed392e6c10d130be0dfcb3eda9c0a041f584be55e67b7d1184708d39f2 +size 1028607 diff --git a/BZOJ/3942/data/1.out b/BZOJ/3942/data/1.out new file mode 100644 index 00000000..67711aa2 --- /dev/null +++ b/BZOJ/3942/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8690abec24711f0eee16d52d0057e34bc3a327b82c62c579dfeddf8584c32430 +size 856976 diff --git a/BZOJ/3942/data/10.in b/BZOJ/3942/data/10.in new file mode 100644 index 00000000..b5176659 --- /dev/null +++ b/BZOJ/3942/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011c4fff3b2964ccdbfcd247743003aa7f0ce1d5dd54a4fa5b27c0bf5256cc0e +size 1694697 diff --git a/BZOJ/3942/data/10.out b/BZOJ/3942/data/10.out new file mode 100644 index 00000000..77e5622d --- /dev/null +++ b/BZOJ/3942/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbb1cd29a8319a7683e2d43094bd1484daae7006dd4f2d355871bf6ad9f6bb03 +size 305306 diff --git a/BZOJ/3942/data/11.in b/BZOJ/3942/data/11.in new file mode 100644 index 00000000..5b4adb1f --- /dev/null +++ b/BZOJ/3942/data/11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fee0eab84aee3f2106f92d1ddb37c4979f2a0590b7b0a78015eb7d55cc3256c6 +size 1000092 diff --git a/BZOJ/3942/data/11.out b/BZOJ/3942/data/11.out new file mode 100644 index 00000000..841973dc --- /dev/null +++ b/BZOJ/3942/data/11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fa61e8416f63325746c4cecc465e65d58efeae22963b98562f144497362790f +size 92621 diff --git a/BZOJ/3942/data/12.in b/BZOJ/3942/data/12.in new file mode 100644 index 00000000..30b7b1b2 --- /dev/null +++ b/BZOJ/3942/data/12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab61b70f42c96f8b39dd2bffaced9b9dcfe44752026fcbf8da9b33d11d95fca5 +size 530 diff --git a/BZOJ/3942/data/12.out b/BZOJ/3942/data/12.out new file mode 100644 index 00000000..0fe622d7 --- /dev/null +++ b/BZOJ/3942/data/12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e003cc260fdb9818990c24e49c270ea6aaa9f38fa04ca1fee990e0c933b2b08d +size 109 diff --git a/BZOJ/3942/data/13.in b/BZOJ/3942/data/13.in new file mode 100644 index 00000000..a5695ef1 --- /dev/null +++ b/BZOJ/3942/data/13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8bde2dd99cdf0b15bc8857622830f52b6120329d94ee78a86ad88afc1990a53 +size 1000022 diff --git a/BZOJ/3942/data/13.out b/BZOJ/3942/data/13.out new file mode 100644 index 00000000..c863f162 --- /dev/null +++ b/BZOJ/3942/data/13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22d095b9fa27f06ada7e43d956789b85e60b5fee7f21bf8b44351f3ab53c434c +size 681 diff --git a/BZOJ/3942/data/14.in b/BZOJ/3942/data/14.in new file mode 100644 index 00000000..112ae748 --- /dev/null +++ b/BZOJ/3942/data/14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b564afaeba39cabdc8a7f525c8427f0e8e081959c03be970ca530dbf6a894e66 +size 1386662 diff --git a/BZOJ/3942/data/14.out b/BZOJ/3942/data/14.out new file mode 100644 index 00000000..18a220ba --- /dev/null +++ b/BZOJ/3942/data/14.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f7f5c0bc0e0df2b91030fe31e11596df37cc10d289973a06f43ee49d6a211c7 +size 613341 diff --git a/BZOJ/3942/data/15.in b/BZOJ/3942/data/15.in new file mode 100644 index 00000000..901589d5 --- /dev/null +++ b/BZOJ/3942/data/15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4c90e605c8e87556554267bebaa9e1ab362ab0ee6c1e05f74874d196b719b5e +size 1004227 diff --git a/BZOJ/3942/data/15.out b/BZOJ/3942/data/15.out new file mode 100644 index 00000000..1d734b16 --- /dev/null +++ b/BZOJ/3942/data/15.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49f175008d28cb78fe0b7eeec61994e6b482548bd47a3c66ee910045c7715395 +size 721151 diff --git a/BZOJ/3942/data/2.in b/BZOJ/3942/data/2.in new file mode 100644 index 00000000..e234ae74 --- /dev/null +++ b/BZOJ/3942/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1300e17f6568f4768e5ef5b4427d97080c0e4bfa27333b3355333b128faa38f0 +size 1030907 diff --git a/BZOJ/3942/data/2.out b/BZOJ/3942/data/2.out new file mode 100644 index 00000000..826b70f0 --- /dev/null +++ b/BZOJ/3942/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc68dd856219acff3ed4f31b0c6a91b1ff9af181976ce057dce779dec9657ad1 +size 474616 diff --git a/BZOJ/3942/data/3.in b/BZOJ/3942/data/3.in new file mode 100644 index 00000000..06a19349 --- /dev/null +++ b/BZOJ/3942/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1219279ad904b826bbc29c09985e9e394b394ee4204b5193440282a96f56e7f5 +size 1023626 diff --git a/BZOJ/3942/data/3.out b/BZOJ/3942/data/3.out new file mode 100644 index 00000000..fd79c1b6 --- /dev/null +++ b/BZOJ/3942/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:315bcce293c6865840cdcb32d51bff1c40e2566c63ea4c41397b1e5c5af861c8 +size 716513 diff --git a/BZOJ/3942/data/4.in b/BZOJ/3942/data/4.in new file mode 100644 index 00000000..8bb10c50 --- /dev/null +++ b/BZOJ/3942/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8052f15d820981b69368a27109ede85588514c76096c3e1a18e0f7fa9950bbb0 +size 1042807 diff --git a/BZOJ/3942/data/4.out b/BZOJ/3942/data/4.out new file mode 100644 index 00000000..83e23d39 --- /dev/null +++ b/BZOJ/3942/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0430bc196fd753ae328e4d987ef80e7066d5834826cdd61b2127b85d0c25c808 +size 186706 diff --git a/BZOJ/3942/data/5.in b/BZOJ/3942/data/5.in new file mode 100644 index 00000000..1d69dce7 --- /dev/null +++ b/BZOJ/3942/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:288048ee5bba67ccec42af467d33640edc043ca799b0e9ef192f28094d397526 +size 21 diff --git a/BZOJ/3942/data/5.out b/BZOJ/3942/data/5.out new file mode 100644 index 00000000..6bb0723f --- /dev/null +++ b/BZOJ/3942/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55900abf2e93d0d8039fcbd58481bd3d006a1edce3938c7bb6435f7c27e74132 +size 11 diff --git a/BZOJ/3942/data/6.in b/BZOJ/3942/data/6.in new file mode 100644 index 00000000..e43b68b1 --- /dev/null +++ b/BZOJ/3942/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9eca1b452f448ae2a0e5f1d9715d07245f9e12c90f9f21a493a800a945a94bd +size 1500162 diff --git a/BZOJ/3942/data/6.out b/BZOJ/3942/data/6.out new file mode 100644 index 00000000..7edac4bf --- /dev/null +++ b/BZOJ/3942/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d01446f14af2a956fd5d48cd79f6f1b7b40b4fdc795fe972bbfdc596b577941 +size 999937 diff --git a/BZOJ/3942/data/7.in b/BZOJ/3942/data/7.in new file mode 100644 index 00000000..9d8ec318 --- /dev/null +++ b/BZOJ/3942/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57504e0585c79285b1bd51a55c86305c123e51737b22f8157a7cd00c8ad20448 +size 1967827 diff --git a/BZOJ/3942/data/7.out b/BZOJ/3942/data/7.out new file mode 100644 index 00000000..be0f0c14 --- /dev/null +++ b/BZOJ/3942/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:286c97c958b4d16b5690b20b3a5a499294619692be42844a3a320e4397c2bb8f +size 32176 diff --git a/BZOJ/3942/data/8.in b/BZOJ/3942/data/8.in new file mode 100644 index 00000000..052def01 --- /dev/null +++ b/BZOJ/3942/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82feba53e13a03eab65977d88d06f7119e3b6e54330b1e2f1fc8f6623d9ccae6 +size 1003362 diff --git a/BZOJ/3942/data/8.out b/BZOJ/3942/data/8.out new file mode 100644 index 00000000..bc628365 --- /dev/null +++ b/BZOJ/3942/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e46ac70963c236e3a703e1fa036fe1b4d99c9e4db1e3202ca2d386d5c0e26d65 +size 546401 diff --git a/BZOJ/3942/data/9.in b/BZOJ/3942/data/9.in new file mode 100644 index 00000000..2dc44437 --- /dev/null +++ b/BZOJ/3942/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b37838324ee21a98fffc6f49df030e7698da9a69face9d39d25deb003b77c7cb +size 1029297 diff --git a/BZOJ/3942/data/9.out b/BZOJ/3942/data/9.out new file mode 100644 index 00000000..bcb8563d --- /dev/null +++ b/BZOJ/3942/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7abf972a73da90783f781f77e9ce715cf06073a11b6d541fddf0cef44224b44 +size 121151