Submission #1086194

# Submission time Handle Problem Language Result Execution time Memory
1086194 2024-09-09T17:24:45 Z I_am_Polish_Girl Intercastellar (JOI22_ho_t1) C++14
100 / 100
65 ms 12480 KB
//#pragma target("arch=icelake-server")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack> 
#include <queue>
#include <cmath>
#include <random>
#include <chrono>
#include <iomanip>
#include <bitset>

using namespace std;

#define int long long

typedef long long ll;
typedef long double ld;

int log_ = 11;
int inf = 4000000007000000007;

long long mod = 1000000007;

int p = 499;

int NADIYA = 39;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	int n;
	cin >> n;

	vector <int> a(n);

	for (int i = 0; i < n; i++)
		cin >> a[i];

	vector <pair <int, int>> vp;

	for (int i = 0; i < n; i++)
	{
		int c = 1;

		while (a[i] % (c*2) == 0)
			c *= 2;

		vp.push_back({ c , a[i] / c });
	}

	vector <int> pref(n);
	int p = 0;
	
	for (int i = 0; i < n; i++)
	{
		p += vp[i].first;

		pref[i] = p;
	}

	int q;
	cin >> q;
	
	while (q--)
	{
		int ind;
		cin >> ind;

		int l = lower_bound(pref.begin(), pref.end(), ind) - pref.begin();

		//cerr << "R:";
		cout << vp[l].second << "\n";
	}
}

/*5
1 2 1
2 3 1
2 4 1
1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 17 ms 7020 KB Output is correct
4 Correct 20 ms 3032 KB Output is correct
5 Correct 35 ms 8656 KB Output is correct
6 Correct 25 ms 6596 KB Output is correct
7 Correct 36 ms 8644 KB Output is correct
8 Correct 39 ms 8792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 356 KB Output is correct
12 Correct 1 ms 520 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 17 ms 7020 KB Output is correct
4 Correct 20 ms 3032 KB Output is correct
5 Correct 35 ms 8656 KB Output is correct
6 Correct 25 ms 6596 KB Output is correct
7 Correct 36 ms 8644 KB Output is correct
8 Correct 39 ms 8792 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 452 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 356 KB Output is correct
20 Correct 1 ms 520 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 19 ms 3544 KB Output is correct
24 Correct 27 ms 7428 KB Output is correct
25 Correct 51 ms 12088 KB Output is correct
26 Correct 34 ms 7624 KB Output is correct
27 Correct 35 ms 7884 KB Output is correct
28 Correct 61 ms 12480 KB Output is correct
29 Correct 65 ms 11968 KB Output is correct
30 Correct 26 ms 4176 KB Output is correct
31 Correct 64 ms 12228 KB Output is correct