Submission #1154415

#TimeUsernameProblemLanguageResultExecution timeMemory
1154415tsengangIntercastellar (JOI22_ho_t1)C++20
100 / 100
253 ms7360 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define all(x) (x).begin(), (x).end() #define pb push_back #define ertunt return const int MOD = 998244353; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") int main() { ll n; cin >> n; ll a[n]; for(ll i = 0; i < n; i++) cin >> a[i]; ll q; cin >> q; ll lst = 0; vector<pair<ll,ll>> v; for(ll i = 0; i < n; i++){ ll cnt = 0; while(a[i] % 2 == 0){ a[i] /= 2; cnt++; } lst += (1LL << cnt); v.pb({lst, a[i]}); } while(q--){ ll x; cin >> x; auto y = lower_bound(all(v), make_pair(x, -1LL)); cout << y->ss << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...