diff options
| author | mzuenni <michi.zuendorf@gmail.com> | 2023-03-28 13:25:59 +0200 |
|---|---|---|
| committer | mzuenni <michi.zuendorf@gmail.com> | 2023-03-28 13:25:59 +0200 |
| commit | fe5fa1141efeb7454c763dbd2645fb4ff04487a3 (patch) | |
| tree | f2197bb94ce80ab2fae886177dfa9b0bd11538ac /math/permIndex.cpp | |
| parent | 3b91d2662310aee532cc84e1447824459671767e (diff) | |
merged
Diffstat (limited to 'math/permIndex.cpp')
| -rw-r--r-- | math/permIndex.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/math/permIndex.cpp b/math/permIndex.cpp index 09ff7f7..4cffc12 100644 --- a/math/permIndex.cpp +++ b/math/permIndex.cpp @@ -6,9 +6,8 @@ ll permIndex(vector<ll> v) { x = t.order_of_key(x); } ll res = 0; - for (ll i = sz(v); i > 0; i--) { - res *= i; - res += v[i - 1]; + for (int i = sz(v); i > 0; i--) { + res = res * i + v[i - 1]; } return res; } |
