Submission #916018

#TimeUsernameProblemLanguageResultExecution timeMemory
916018yeediotIntercastellar (JOI22_ho_t1)C++14
100 / 100
64 ms11000 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pii pair<int,int> #define all(X) X.begin(),X.end() #define chmax(a,b) a=max(a,b) #define chmin(a,b) a=min(a,b) #ifdef local void setio(){freopen("/Users/iantsai/Library/Mobile Documents/com~apple~CloudDocs/cpp/Empty.md","r",stdin);} #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else void setio(){} #define debug(x...) #endif signed main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); setio(); int n; cin>>n; vector<int>v; vector<int>cnt(n); vector<int>ans(n); for(int i=0;i<n;i++){ int x; cin>>x; v.pb(x); int tmp=0; //cout<<x<<' '; while((x>>tmp&1)==0)tmp++; cnt[i]=(1ll<<tmp); ans[i]=x/cnt[i]; //cout<<cnt[i]<<' '; } int q; cin>>q; int p=0,cur=0; for(int i=0;i<q;i++){ int x; cin>>x; while(x>cnt[p]+cur){ cur+=cnt[p]; p++; } cout<<ans[p]<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...