Submission #806675

#TimeUsernameProblemLanguageResultExecution timeMemory
806675CookieIntercastellar (JOI22_ho_t1)C++14
100 / 100
73 ms8716 KiB
#include<bits/stdc++.h> #include<fstream> #pragma GCC optimize("Ofast,O3,unroll-loops") #pragma GCC target("avx2") using namespace std; //ifstream fin("FEEDING.INP"); //ofstream fout("FEEDING.OUT"); #define sz(a) (int)a.size() #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld long double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> const int base = 74; const ll p = 31, mod = 1e9 + 7, inf = 1e9, mxv = 1005, mxn = 2e5 + 5; int n; ll a[mxn + 1], cnt[mxn + 1]; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++)cin >> a[i]; for(int i = 1; i <= n; i++){ ll &x = a[i]; while(x % 2 == 0){ cnt[i]++; x /= 2; } } int q; cin >> q; int r = 1; ll tot = 0; while(q--){ ll x; cin >> x; while(tot + (1LL << cnt[r]) < x){ tot += (1LL << cnt[r]); r++; } cout << a[r] << "\n"; } return(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...