제출 #1319198

#제출 시각아이디문제언어결과실행 시간메모리
1319198nambanana987Intercastellar (JOI22_ho_t1)C++20
100 / 100
50 ms5288 KiB
#include <bits/stdc++.h> #include <climits> using namespace std; #define f first #define s second #define all(a) a.begin(),a.end() #define sz(a) (int)a.size() #define int long long #define mk make_pair const int N=2e5+5; const int N1=1e15; int fact[N]; int M[N],res[N]; int n,q; void sieve(){ for(int i=1;i*i<N1;++i) fact[i]=i; for(int i=2;i*i<N1;++i){ if(fact[i]!=i) continue; for(int j=i*i;j<N1;j+=i){ if(fact[j]==j) fact[j]=i; } } } void solve(){ cin>>n; for(int i=1;i<=n;++i ){ int temp;cin>>temp; int hai=1; while(temp%2==0){ hai*=2; temp/=2; } M[i]=hai; M[i]+=M[i-1]; res[i]=temp; } cin>>q; while(q--){ int x;cin>>x; int p=lower_bound(M+1,M+n+1,x)-M; cout<<res[p]<<'\n'; } } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...