Submission #828986

# Submission time Handle Problem Language Result Execution time Memory
828986 2023-08-17T22:54:21 Z OAleksa Intercastellar (JOI22_ho_t1) C++14
100 / 100
74 ms 12304 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std; 
#define int long long

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tt = 1;
	//cin >> tt;
	while(tt--) {
		int n;
		cin >> n;
		vector<int> a(n);
		for(int i = 0;i < n;i++)
			cin >> a[i];
		vector<int> b(n), c(n);
		for(int i = 0;i < n;i++) {
			int x = a[i];
			while(x % 2 == 0)
				x /= 2;
			b[i] = a[i] / x;
			c[i] = x;
		}
		vector<int> p(n);
		p[0] = b[0];
		for(int i = 1;i < n;i++)
			p[i] = p[i - 1] + b[i];
		int q;
		cin >> q;
		for(int i = 1;i <= q;i++) {
			int x;
			cin >> x;
			auto u = lower_bound(p.begin(), p.end(), x) - p.begin();
			cout << c[u] << "\n";
		}
	}
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 20 ms 7020 KB Output is correct
4 Correct 24 ms 3120 KB Output is correct
5 Correct 51 ms 8684 KB Output is correct
6 Correct 24 ms 6696 KB Output is correct
7 Correct 41 ms 8660 KB Output is correct
8 Correct 44 ms 8740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 316 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 320 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 1 ms 340 KB Output is correct
11 Correct 1 ms 328 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 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 20 ms 7020 KB Output is correct
4 Correct 24 ms 3120 KB Output is correct
5 Correct 51 ms 8684 KB Output is correct
6 Correct 24 ms 6696 KB Output is correct
7 Correct 41 ms 8660 KB Output is correct
8 Correct 44 ms 8740 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 316 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 320 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 1 ms 340 KB Output is correct
19 Correct 1 ms 328 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 340 KB Output is correct
23 Correct 28 ms 3572 KB Output is correct
24 Correct 29 ms 7432 KB Output is correct
25 Correct 54 ms 11916 KB Output is correct
26 Correct 36 ms 7500 KB Output is correct
27 Correct 34 ms 7748 KB Output is correct
28 Correct 61 ms 12304 KB Output is correct
29 Correct 60 ms 11732 KB Output is correct
30 Correct 33 ms 4056 KB Output is correct
31 Correct 74 ms 12244 KB Output is correct