Submission #910526

#TimeUsernameProblemLanguageResultExecution timeMemory
910526SuPythonyIntercastellar (JOI22_ho_t1)C++17
100 / 100
385 ms5320 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:8:8: warning: unused variable 'm' [-Wunused-variable]
    8 |     ll m=0;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...