Submission #585781

# Submission time Handle Problem Language Result Execution time Memory
585781 2022-06-29T10:44:02 Z Drew_ Intercastellar (JOI22_ho_t1) C++17
100 / 100
1016 ms 13264 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr << "[" << #x << "]: " << x << "\n";

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;

constexpr ld PI = 4*atan((ld)1);

int main()
{
	fastio;

	int n;
	cin >> n;

	vector<pl> v;
	for (int i = 0; i < n; ++i)
	{
		ll x; cin >> x;

		ll ctr = 1;
		while (x % 2 == 0)
			x /= 2, ctr *= 2;
		v.pb({ctr, x});
	}

	for (int i = 1; i < n; ++i)
		v[i].f1 += v[i-1].f1;

	for (auto &[x, y] : v)
		cerr << x << " " << y << '\n';

	int q;
	cin >> q;

	while (q--)
	{
		ll x; cin >> x;
		auto it = lower_bound(v.begin(), v.end(), mp(x, 0ll));
		cout << it -> s2 << '\n';
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 878 ms 5892 KB Output is correct
4 Correct 285 ms 2836 KB Output is correct
5 Correct 953 ms 7536 KB Output is correct
6 Correct 786 ms 5664 KB Output is correct
7 Correct 964 ms 7480 KB Output is correct
8 Correct 981 ms 7692 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 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 5 ms 340 KB Output is correct
8 Correct 7 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 878 ms 5892 KB Output is correct
4 Correct 285 ms 2836 KB Output is correct
5 Correct 953 ms 7536 KB Output is correct
6 Correct 786 ms 5664 KB Output is correct
7 Correct 964 ms 7480 KB Output is correct
8 Correct 981 ms 7692 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 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 7 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 5 ms 340 KB Output is correct
20 Correct 5 ms 340 KB Output is correct
21 Correct 5 ms 340 KB Output is correct
22 Correct 6 ms 340 KB Output is correct
23 Correct 178 ms 3680 KB Output is correct
24 Correct 724 ms 7824 KB Output is correct
25 Correct 982 ms 12488 KB Output is correct
26 Correct 675 ms 8124 KB Output is correct
27 Correct 700 ms 8528 KB Output is correct
28 Correct 1014 ms 13264 KB Output is correct
29 Correct 1016 ms 12384 KB Output is correct
30 Correct 166 ms 4340 KB Output is correct
31 Correct 1004 ms 13160 KB Output is correct