Submission #982189

#TimeUsernameProblemLanguageResultExecution timeMemory
982189AiperiiiIntercastellar (JOI22_ho_t1)C++14
35 / 100
2082 ms3740 KiB
#include <bits/stdc++.h> #define int long long #define ull unsigned long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <int> a(n),kol(n); for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]%2==1)kol[i]=1; else{ int x=a[i]; int cnt=1; while(x%2==0){ x/=2; cnt*=2; } kol[i]=cnt; a[i]=x; } } int q; cin>>q; while(q--){ int pos; cin>>pos; for(int i=0;i<n;i++){ if(kol[i]>=pos){ cout<<a[i]<<"\n";break; } else pos-=kol[i]; } } } /* 4 14 9 8 12 6 2 3 5 7 11 13 13 1 4 1 4 2 1 3 5 6 2 3 7 3 8 2 10 11 13 15 17 18 20 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...