//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#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 |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
21 ms |
4548 KB |
Output is correct |
4 |
Correct |
28 ms |
2504 KB |
Output is correct |
5 |
Correct |
49 ms |
6756 KB |
Output is correct |
6 |
Correct |
28 ms |
4304 KB |
Output is correct |
7 |
Correct |
48 ms |
5648 KB |
Output is correct |
8 |
Correct |
36 ms |
4088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
21 ms |
4548 KB |
Output is correct |
4 |
Correct |
28 ms |
2504 KB |
Output is correct |
5 |
Correct |
49 ms |
6756 KB |
Output is correct |
6 |
Correct |
28 ms |
4304 KB |
Output is correct |
7 |
Correct |
48 ms |
5648 KB |
Output is correct |
8 |
Correct |
36 ms |
4088 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
328 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
27 ms |
3444 KB |
Output is correct |
24 |
Correct |
35 ms |
7116 KB |
Output is correct |
25 |
Correct |
67 ms |
10524 KB |
Output is correct |
26 |
Correct |
45 ms |
6724 KB |
Output is correct |
27 |
Correct |
42 ms |
7112 KB |
Output is correct |
28 |
Correct |
80 ms |
10788 KB |
Output is correct |
29 |
Correct |
64 ms |
7108 KB |
Output is correct |
30 |
Correct |
40 ms |
3936 KB |
Output is correct |
31 |
Correct |
79 ms |
10300 KB |
Output is correct |