Submission #970667

#TimeUsernameProblemLanguageResultExecution timeMemory
970667detectivebowonIntercastellar (JOI22_ho_t1)C++17
0 / 100
1 ms600 KiB
#include<bits/stdc++.h> #define ll long long #define int 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; posi.emplace_back(1); value.emplace_back(-1); 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()==1) posi.emplace_back(size); else posi.emplace_back(posi[posi.size()-1]+size); value.emplace_back(num/size); } 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...