제출 #1239132

#제출 시각아이디문제언어결과실행 시간메모리
1239132ebrambillIntercastellar (JOI22_ho_t1)C++20
100 / 100
264 ms5384 KiB
//In the name of GOD #include <bits/stdc++.h> using namespace std; const long long maxN=2e5+5; long long n, q, a[maxN], ps[maxN]; int main(){ cin >>n; for (long long i=1; i<=n; i++){ cin >>a[i]; ps[i]=ps[i-1]+(1<<__builtin_ctz(a[i])); } cin >>q; while(q--){ long long x; cin >>x; long long l=0, r=n; while(r-l>1){ long long mid=(r+l)>>1; if(ps[mid]>=x) r=mid; else l=mid; } cout <<(a[r]>>__builtin_ctz(a[r])) <<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...