#include #include #include using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector a(n); for (int i=0;i<n;++i) cin>>a[i]; vector b(n); b[0]=a[0]+1; int max_j=1; for (int i=1;i<n;++i) { ll need=b[i-1]-a[i]; if (need<=0) { b[i]=a[i]+1; max_j=max(max_j,1); } else { int j=0; while (need>0) { need-=(1LL << (2j))-1; ++j; } b[i]=a[i]+(1LL << (2j))-1; max_j=max(max_j,j); } } cout<<max_j<<endl; return 0; }

2 comments

  • @ 2025-12-29 13:40:39

    (1LL << (2j)) 应为(1LL << (2*j))

    • @ 2025-12-20 12:16:02

      就不能用代码块搞起来吗?

      你这样直接粘贴谁看的出来?

      👍 1
      • 1

      Information

      ID
      44
      Time
      ms
      Memory
      MiB
      Difficulty
      4
      Tags
      # Submissions
      46
      Accepted
      1
      Uploaded By