Submission #922885

#TimeUsernameProblemLanguageResultExecution timeMemory
922885ting39Intercastellar (JOI22_ho_t1)C++17
100 / 100
399 ms10896 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int n; cin>>n; vector<int> v(n),cnt(n),pre(n); for(int &i:v) cin>>i; for(int i=0;i<n;i++){ cnt[i]=v[i]&-v[i]; } for(int i=0;i<n;i++){ pre[i]=cnt[i]; if(i!=0) pre[i]+=pre[i-1]; } int q; cin>>q; while(q--){ int x; cin>>x; int l=0,r=n-1,mid; if(cnt[0]>=x) r=0; while(r-l>1){ mid=(l+r)>>1; if(pre[mid]>=x) r=mid; else l=mid; } cout<<(v[r]/cnt[r])<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...