Submission #970673

#TimeUsernameProblemLanguageResultExecution timeMemory
970673detectivebowonIntercastellar (JOI22_ho_t1)C++14
100 / 100
107 ms9532 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll n,two[37]; vector<ll> posi,value; signed main() { ios_base::sync_with_stdio(false);cin.tie(nullptr); for(int i=0;i<=30;i++) { two[i]=(1<<i); } cin>>n; for(int i=1;i<=n;i++) { ll num; cin>>num; ll size=0; for(int i=0;i<=30;i++) { if(two[i]>num) break; if(num%two[i]==0) { size=two[i]; } } if(posi.size()==0) posi.emplace_back(size); else posi.emplace_back(posi[posi.size()-1]+size); value.emplace_back(num/size); } // for(int i=1;i<=n;i++) // { // cout<<posi[i]<<" "; // } int q; cin>>q; while(q--) { ll tmp; cin>>tmp; int it=lower_bound(posi.begin(),posi.end(),tmp)-posi.begin(); cout<<value[it]<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...