diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
| commit | 1880ccb6d85c6eb79e724593457877bab431951c (patch) | |
| tree | 23eddd5bd0b29b3024e170a5ef9023eda9226ab5 /test/string/longestCommonSubsequence.cpp | |
| parent | e95f59debd69ee7d45d5c966ce466d23264e1c3c (diff) | |
get rid of all() and sz()
Diffstat (limited to 'test/string/longestCommonSubsequence.cpp')
| -rw-r--r-- | test/string/longestCommonSubsequence.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/string/longestCommonSubsequence.cpp b/test/string/longestCommonSubsequence.cpp index 6d7a6c5..128c3c1 100644 --- a/test/string/longestCommonSubsequence.cpp +++ b/test/string/longestCommonSubsequence.cpp @@ -4,19 +4,19 @@ bool isSubstr(string_view s, string_view sub) { int i = 0; for (char c : s) { - if (i < sz(sub) && c == sub[i]) i++; + if (i < ssize(sub) && c == sub[i]) i++; } - return i >= sz(sub); + return i >= ssize(sub); } string naive(string_view s, string_view t) { string res = ""; - for (ll i = 1; i < (1ll << sz(s)); i++) { + for (ll i = 1; i < (1ll << ssize(s)); i++) { string tmp; - for (ll j = 0; j < sz(s); j++) { + for (ll j = 0; j < ssize(s); j++) { if (((i >> j) & 1) != 0) tmp.push_back(s[j]); } - if (sz(tmp) >= sz(res) && isSubstr(t, tmp)) res = tmp; + if (ssize(tmp) >= ssize(res) && isSubstr(t, tmp)) res = tmp; } return res; } @@ -44,7 +44,7 @@ void performance_test() { t.start(); auto res = lcss(a, b); t.stop(); - hash_t hash = sz(res); + hash_t hash = ssize(res); if (t.time > 500) cerr << "too slow: " << t.time << FAIL; cerr << "tested performance: " << t.time << "ms (hash: " << hash << ")" << endl; } |
