From fe5fa1141efeb7454c763dbd2645fb4ff04487a3 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Tue, 28 Mar 2023 13:25:59 +0200 Subject: merged --- math/permIndex.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'math/permIndex.cpp') 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 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; } -- cgit v1.2.3