Submission #548680

#TimeUsernameProblemLanguageResultExecution timeMemory
548680cpp219Intercastellar (JOI22_ho_t1)C++17
100 / 100
81 ms10736 KiB
#include<bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define debug(y) cout<<y,exit(0) using namespace std; typedef pair<ll,ll> LL; const ll N = 2e5 + 9; const ll inf = 1e18 + 7; ll n,Q,x,a[N],q[N],ans[N]; vector<ll> v; int main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "test" if (fopen(task".inp","r")){ freopen(task".inp","r",stdin); //freopen(task".out","w",stdout); } cin>>n; for (ll i = 1;i <= n;i++) cin>>a[i]; cin>>Q; for (ll i = 1;i <= Q;i++) cin>>q[i]; ll nth = 0,cur = 1; for (ll i = 1;i <= n;i++){ ll cnt = 1; while(a[i]%2 == 0) a[i] /= 2,cnt *= 2; nth += cnt; while(q[cur] <= nth && cur <= Q) ans[cur] = a[i],cur++; } //debug(nth); for (ll i = 1;i <= Q;i++) cout<<ans[i]<<"\n"; } /// be confident

Compilation message (stderr)

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