Submission #954419

#TimeUsernameProblemLanguageResultExecution timeMemory
954419amirhoseinfar1385Intercastellar (JOI22_ho_t1)C++17
0 / 100
263 ms8876 KiB
#include<bits/stdc++.h> using namespace std; const long long maxn=200000+10; long long n; long long all[maxn]; vector<long long>alls,allv; void vorod(){ cin>>n; for(long long i=1;i<=n;i++){ cin>>all[i]; } } void pre(){ alls.resize(n+2); allv.resize(n+2); for(long long i=1;i<=n;i++){ allv[i]=all[i]; while((allv[i]&1)==0){ allv[i]>>=1; } alls[i+1]=alls[i]+all[i]/allv[i]; } } void solve(){ long long q; cin>>q; for(long long i=0;i<q;i++){ long long x; cin>>x; long long p=lower_bound(alls.begin(),alls.end(),x)-alls.begin(); p--; cout<<allv[p]<<"\n"; } } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); freopen("inp.txt","r",stdin); vorod(); pre(); solve(); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:43:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |  freopen("inp.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...