# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1016004 | ZeroCool | Intercastellar (JOI22_ho_t1) | C++14 | 55 ms | 9404 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ar array
#define ld long double
const int N = 3e5 + 30;
const int M = 10;
const int MOD = 998244353;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
const int inv = 499122177;
signed main(){ios::sync_with_stdio(false);cin.tie(0);
int n;
cin>>n;
int c = 0;
vector<ar<int, 2> > v;
for(int i = 0;i < n;i++){
int x;
cin>>x;
int cnt = 1;
while(x % 2 == 0){
x /= 2;
cnt *= 2;
}
v.push_back({c, x});
c += cnt;
}
//for(auto [a, b]: v)cout<<a<<" "<<b<<endl;
int q;
cin>>q;
while(q--){
int x;
cin>>x;
auto it = upper_bound(v.begin(), v.end(), ar<int,2>{x, 0});
--it;
cout<<(*it)[1]<<'\n';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |