I was just doing virtual on 1338A - Прибавление степеней.
I wrote the following code: <spoiler summary="#include <bits/stdc++.h> using namespace std;
typedef long long ll;
typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<int, ll> pil; typedef pair<ll, ll> pll;
define mp make_pair
define fr first
define sc second
void solve() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } if (is_sorted(A.begin(), A.end())) { cout << 0 << '\n'; return; } int ans = 0, mx = -1e9; for (int i = 0; i < N; i++) { mx = max(mx, A[i]); ans = max(ans, __lg(mx — A[i]) + 1); } cout << ans << '\n'; }
int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
endif
int t = 1; cin >> t; while (t--) solve(); return 0;
}"> ...
and it out puts "63" on this test.
...
But I thought __lg(0) is -1?
Does anyone have any idea?
(Also I tried to use custom invocation and try to exit once "ans" is changed to 63 but nothing happened.)