Submission #1016004

# Submission time Handle Problem Language Result Execution time Memory
1016004 2024-07-07T09:20:29 Z ZeroCool Intercastellar (JOI22_ho_t1) C++14
100 / 100
55 ms 9404 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ll long long
#define ar array
#define ld long double

const int N = 3e5 + 30;
const int M = 10;
const int MOD = 998244353;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

const int inv = 499122177;


signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	int n;
	cin>>n;
	int c = 0;
	vector<ar<int, 2> > v;
	for(int i = 0;i < n;i++){
		int x;
		cin>>x;
		int cnt = 1;
		while(x % 2 == 0){
			x /= 2;
			cnt *= 2;
		}
		v.push_back({c, x});
		c += cnt;
	}
	//for(auto [a, b]: v)cout<<a<<" "<<b<<endl;
	int q;
	cin>>q;
	while(q--){
		int x;
		cin>>x;
		auto it = upper_bound(v.begin(), v.end(), ar<int,2>{x, 0});
		--it;
		cout<<(*it)[1]<<'\n';
	}
}

Compilation message

Main.cpp:15: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   15 | #pragma GCC optimization ("O3")
      | 
Main.cpp:16: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   16 | #pragma GCC optimization ("unroll-loops")
      |
# 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 16 ms 5196 KB Output is correct
4 Correct 22 ms 2520 KB Output is correct
5 Correct 37 ms 5824 KB Output is correct
6 Correct 22 ms 5076 KB Output is correct
7 Correct 37 ms 5832 KB Output is correct
8 Correct 38 ms 5728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 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 0 ms 348 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
# 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 16 ms 5196 KB Output is correct
4 Correct 22 ms 2520 KB Output is correct
5 Correct 37 ms 5824 KB Output is correct
6 Correct 22 ms 5076 KB Output is correct
7 Correct 37 ms 5832 KB Output is correct
8 Correct 38 ms 5728 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 456 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 0 ms 348 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 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 19 ms 3284 KB Output is correct
24 Correct 25 ms 6100 KB Output is correct
25 Correct 50 ms 8896 KB Output is correct
26 Correct 31 ms 5828 KB Output is correct
27 Correct 31 ms 6100 KB Output is correct
28 Correct 55 ms 9404 KB Output is correct
29 Correct 54 ms 8892 KB Output is correct
30 Correct 36 ms 3792 KB Output is correct
31 Correct 55 ms 9404 KB Output is correct