# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
910526 | SuPythony | Intercastellar (JOI22_ho_t1) | C++17 | 385 ms | 5320 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;
typedef long long ll;
int main() {
int n; cin>>n;
vector<ll> p(n);
ll m=0;
for (int i=0; i<n; i++) {
cin>>p[i];
}
vector<ll> c(n);
for (int i=0; i<n; i++) {
if (i==0) {
c[i]=p[i]&-p[i];
} else {
c[i]=c[i-1]+(p[i]&-p[i]);
}
}
int q; cin>>q;
while (q--) {
ll x; cin>>x;
auto it=lower_bound(c.begin(),c.end(),x);
int ind=it-c.begin();
ll n;
if (ind==0) n=*it;
else n=*it-c[ind-1];
if (n==1) cout<<p[ind]<<"\n";
else if (n==p[ind]) cout<<1<<"\n";
else cout<<p[ind]/n<<"\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... |