Submission #681669

#TimeUsernameProblemLanguageResultExecution timeMemory
681669dsyzIntercastellar (JOI22_ho_t1)C++17
100 / 100
77 ms10764 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAXN (1000005) int main() { ios_base::sync_with_stdio(false);cin.tie(0); ll N; cin>>N; ll arr[N]; for(ll i = 0;i < N;i++){ cin>>arr[i]; } ll A[N]; ll end[N]; for(ll i = 0;i < N;i++){ ll cnt = 0; ll a = arr[i]; while(a % 2 == 0){ a /= 2; cnt++; } A[i] = (1ll<<cnt); end[i] = a; } ll ptr = 0; ll Q; cin>>Q; ll total = A[0]; for(ll q = 0;q < Q;q++){ ll X; cin>>X; while(total < X){ ptr++; total += A[ptr]; } cout<<end[ptr]<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...