蒟蒻没想到这也能TLE)
Code:
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,maxn=-INT_MAX,ans,dep=1,s;
int qw(int a,int b){
int s=1;
while(b){
if (b&1)s*=a;
a*=a;
b>>=1;
}
return s;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;
while(s!=n){
int k=qw(2,dep-1),sum=0;
s+=k;
for (int i=1;i<=k;i++){
int x;
cin>>x;
sum+=x;
}
if (sum>maxn)maxn=sum,ans=dep;
dep++;
}
cout<<ans;
}