Submission #753082

#TimeUsernameProblemLanguageResultExecution timeMemory
753082Drew_Intercastellar (JOI22_ho_t1)C++17
100 / 100
347 ms9184 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define db double #define ld long double #define pi pair<int,int> #define pll pair<ll,ll> #define pb push_back #define mp make_pair #define fi first #define se second #define debug(x) cout << #x << " => " << x << "\n" int main() { ios_base::sync_with_stdio(false);cin.tie(NULL); ll pow[31]; pow[0]=1; for(ll i=1;i<31;i++) pow[i]=pow[i-1]*2; ll n;cin>>n; ll a[n],b[n]; for(ll i=0;i<n;i++) { ll x;cin>>x; for(ll j=30;j>=0;j--) { if(x%pow[j]==0) { a[i]=pow[j]; b[i]=x/pow[j]; break; } } } for(ll i=1;i<n;i++) a[i]+=a[i-1]; ll q;cin>>q; while(q--) { ll x;cin>>x; ll p=lower_bound(a,a+n,x)-a; cout<<b[p]<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...