Submission #1307579

#TimeUsernameProblemLanguageResultExecution timeMemory
1307579samarthkulkarniIntercastellar (JOI22_ho_t1)C++20
25 / 100
31 ms5420 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define vi vector<long long> #define all(x) x.begin(), x.end() #define endl "\n" void solution(); int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); solution(); return 0; } void solution() { int n; cin >> n; vi a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; ll x = a[i]; int z = 1; while (x&1^1) {z += z; x /= 2;} b[i] = z; if (i > 0) b[i] += b[i-1]; } vi temp(n); for (int i = 0; i < n; i++) { while (a[i]&1^1) a[i]/=2; temp[i] = a[i]; } int q; cin >> q; int j = 0; while (q--) { int x; cin >> x; while (j < n && b[j] < x) j++; cout << temp[j] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...