diff options
| author | mzuenni <michi.zuendorf@gmail.com> | 2024-02-03 14:33:16 +0100 |
|---|---|---|
| committer | mzuenni <michi.zuendorf@gmail.com> | 2024-02-03 14:33:16 +0100 |
| commit | 631335a9c1dd0fba0e17977253d0a4b033aee59a (patch) | |
| tree | 9579d774a927b899f447cb6854d3d4b28f53b5f4 | |
| parent | 155e414b2252a491c626d3382b6a89b13ec3b10d (diff) | |
fix indent
| -rw-r--r-- | other/stress.sh | 2 | ||||
| -rw-r--r-- | string/z.cpp | 16 | ||||
| -rw-r--r-- | tcr.pdf | bin | 666406 -> 667072 bytes |
3 files changed, 9 insertions, 9 deletions
diff --git a/other/stress.sh b/other/stress.sh index 39424ce..d264c2a 100644 --- a/other/stress.sh +++ b/other/stress.sh @@ -2,6 +2,6 @@ for i in {1..1000}; do printf "\r$i" python3 gen.py > input # generate test with gen.py ./a.out < input > out # execute ./a.out - ./b.out < input > out2 # execute ./b.out + ./b.out < input > out2 # execute ./b.out diff out out2 || break done diff --git a/string/z.cpp b/string/z.cpp index c128e9d..069fa38 100644 --- a/string/z.cpp +++ b/string/z.cpp @@ -1,10 +1,10 @@ vector<int> Z(const string& s) { - int n = sz(s); - vector<int> z(n); - for (int i = 1, x = 0; i < n; i++) { - z[i] = max(0, min(z[i - x], x + z[x] - i)); - while (i + z[i] < n && s[z[i]] == s[i + z[i]]) { - x = i, z[i]++; - }} - return z; + int n = sz(s); + vector<int> z(n); + for (int i = 1, x = 0; i < n; i++) { + z[i] = max(0, min(z[i - x], x + z[x] - i)); + while (i + z[i] < n && s[z[i]] == s[i + z[i]]) { + x = i, z[i]++; + }} + return z; } Binary files differ |
