제출 #899450

#제출 시각아이디문제언어결과실행 시간메모리
899450Ice_manIntercastellar (JOI22_ho_t1)C++14
100 / 100
75 ms9316 KiB
#include <iostream> #include <chrono> #include <algorithm> #define maxn 200005 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; #pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math") #pragma GCC target("avx2") using namespace std; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } long long n , q; long long a[maxn] , br[maxn]; void read() { cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; } void solve() { for(int i = 1; i <= n; i++) { br[i] = 1; while(a[i] % 2 == 0) { a[i] /= 2; br[i] *= 2; } br[i] += br[i - 1]; } } void answer() { cin >> q; long long pos; while(q--) { cin >> pos; cout << a[lower_bound(br + 1 , br + 1 + n , pos) - br] << endl; } } int main() { /**#ifdef ONLINE_JUDGE freopen("taxi.in", "r", stdin); freopen("taxi.out", "w", stdout); #endif*/ ios_base::sync_with_stdio(false); cin.tie(nullptr); startT = std::chrono::high_resolution_clock::now(); read(); solve(); answer(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...