Submission #937855

#TimeUsernameProblemLanguageResultExecution timeMemory
937855vjudge1Intercastellar (JOI22_ho_t1)C++17
100 / 100
61 ms10836 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin>>n; vector<int> v(n),d(n); for(int& i : v) cin>>i; vector<int> pre(n+1); for(int i = 0; i<n; i++){ int temp = 0; int x = v[i]; while(x%2 == 0) x/=2, temp++; d[i] = temp; pre[i+1] = pre[i] + (1ll<<temp); // cerr<<pre[i+1]<<" "; } // cerr<<endl; int q; cin>>q; while(q--){ int x; cin>>x; x--; int idx = upper_bound(pre.begin(), pre.end(), x) - pre.begin()-1; x-=pre[idx]; // looking for x // cout<<idx<<" "; cout<<v[idx]/(1ll<<d[idx])<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...