From 1880ccb6d85c6eb79e724593457877bab431951c Mon Sep 17 00:00:00 2001 From: Gloria Mundi Date: Sat, 16 Nov 2024 21:17:29 +0100 Subject: get rid of all() and sz() --- test/other/bitOps.cpp | 6 ++---- test/other/josephus2.cpp | 4 ++-- test/other/josephusK.cpp | 4 ++-- test/other/pbs.cpp | 6 +++--- test/other/sos.cpp | 4 ++-- 5 files changed, 11 insertions(+), 13 deletions(-) (limited to 'test/other') diff --git a/test/other/bitOps.cpp b/test/other/bitOps.cpp index 44f6297..2250521 100644 --- a/test/other/bitOps.cpp +++ b/test/other/bitOps.cpp @@ -31,9 +31,7 @@ ll naive(ll x) { bits.push_back(x & 1); x >>= 1; } - reverse(all(bits)); - next_permutation(all(bits)); - reverse(all(bits)); + ranges::next_permutation(bits | views::reverse); x = 0; for (ll i = 0, j = 1; i < 64; i++, j <<= 1) { if (bits[i] != 0) x |= j; @@ -56,4 +54,4 @@ void test_nextPerm() { int main() { test_subsets(); test_nextPerm(); -} \ No newline at end of file +} diff --git a/test/other/josephus2.cpp b/test/other/josephus2.cpp index 85a9d28..c6b1cd1 100644 --- a/test/other/josephus2.cpp +++ b/test/other/josephus2.cpp @@ -4,8 +4,8 @@ template ll naive(ll n, ll k) { vector state(n); - iota(all(state), O); - for (ll i = k-1; state.size() > 1; i = (i + k - 1) % sz(state)) { + iota(begin(state), end(state), O); + for (ll i = k-1; state.size() > 1; i = (i + k - 1) % ssize(state)) { state.erase(state.begin() + i); } return state[0]; diff --git a/test/other/josephusK.cpp b/test/other/josephusK.cpp index e837640..1a5aa9d 100644 --- a/test/other/josephusK.cpp +++ b/test/other/josephusK.cpp @@ -5,8 +5,8 @@ template ll naive(ll n, ll k) { vector state(n); - iota(all(state), O); - for (ll i = k-1; state.size() > 1; i = (i + k - 1) % sz(state)) { + iota(begin(state), end(state), O); + for (ll i = k-1; state.size() > 1; i = (i + k - 1) % ssize(state)) { state.erase(state.begin() + i); } return state[0]; diff --git a/test/other/pbs.cpp b/test/other/pbs.cpp index ba3b9d0..e1dfea0 100644 --- a/test/other/pbs.cpp +++ b/test/other/pbs.cpp @@ -49,7 +49,7 @@ void stress_test() { for (int i=1; i ans = pbs(Q, MAX_OPERATIONS); t.stop(); - ll hash = accumulate(all(ans), 0LL); + ll hash = accumulate(begin(ans), end(ans), 0LL); if (t.time > 700) cerr << "too slow: " << t.time << FAIL; cerr << "tested performance: " << t.time << "ms (hash: " << hash << ")" << endl; diff --git a/test/other/sos.cpp b/test/other/sos.cpp index f3a6109..3ab34ea 100644 --- a/test/other/sos.cpp +++ b/test/other/sos.cpp @@ -6,8 +6,8 @@ vector sos(const vector& in) { } vector naive(const vector& in) { - vector res(sz(in)); - for (ll i = 0; i < sz(in); i++) { + vector res(ssize(in)); + for (ll i = 0; i < ssize(in); i++) { for (ll j = 0; j <= i; j++) { if ((i | j) == i) { res[i] += in[j]; -- cgit v1.2.3