请问H 题为什么用sort排vector,就超时, 用pair的就能过呢? ~~~~~~~~~ ll br[N]={0}; ll f[100010]; vector<pair<ll ,ll > > v; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >>t; while(t--){ cin >>n; ll sum =0 ; for(int i=1 ;i<=n;i++){ cin>>m; v.push_back({(1<<m) , i}); sum +=(1<<m); } if(sum < (1<<30)){ cout<<"impossible"<<endl; continue ; } sort(v.begin(),v.end()); for(int i=1 ;i<=n;i++)br[i]=0 ; sum = (1<<30) ; for(int i=v.size()-1 ;i>=0;i--) if(sum>=v[i].first){ sum-=v[i].first; br[v[i].second] = 1; } for(int i=1 ;i<=n;i++)cout<<br[i];cout<<endl; } return 0; } ~~~~~~~~~