이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define N 100005
void solve(){
int n; cin >> n;
vector<int> v(n);
vector<pii> res;
res.pb(pii(0, 0));
for(auto &x:v){
cin >> x;
int t = x, cnt = 1;
while(t % 2 == 0){
cnt *= 2; t /= 2;
}
if(t == res.back().ss) res.back().ff += cnt;
else res.pb(pii(cnt, t));
}
int m, k = res.size(); cin >> m;
for(int i = 1; i < k; ++i)
res[i].ff += res[i - 1].ff;
while(m--){
int x; cin >> x;
pii p = *lower_bound(res.begin(), res.end(), pii(x, 0));
cout << p.ss << '\n';
}
}
signed main(){
starburst
int t = 1; //cin >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |