Submission #530275

# Submission time Handle Problem Language Result Execution time Memory
530275 2022-02-25T01:25:32 Z yungyao Intercastellar (JOI22_ho_t1) C++17
100 / 100
64 ms 9184 KB
using namespace std;
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef long long LL;
typedef pair<int,int> pii;
#define pb push_back
#define mkp make_pair
#define F first
#define S second
#define iter(x) x.begin(),x.end()
#define REP(n) for (int __=n;__--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)

const int maxn = 0, mod = 0;
const LL inf = 0;

void solve(){
	int n, q;

	cin >> n;
	vector <pair<LL,LL>> v(n);
	REP0(i, n){
		LL x;

		cin >> x;
		v[i] = mkp(x / (x & -x), x & -x);
	}
	cin >> q;
	LL cnt = 0; int i = -1;
	REP(q){
		LL x;

		cin >> x;
		while (cnt < x) cnt += v[++i].S;
		cout << v[i].F << '\n';
	}
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);

	solve();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 15 ms 3908 KB Output is correct
4 Correct 25 ms 2300 KB Output is correct
5 Correct 40 ms 5484 KB Output is correct
6 Correct 23 ms 4080 KB Output is correct
7 Correct 39 ms 5520 KB Output is correct
8 Correct 39 ms 5612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 15 ms 3908 KB Output is correct
4 Correct 25 ms 2300 KB Output is correct
5 Correct 40 ms 5484 KB Output is correct
6 Correct 23 ms 4080 KB Output is correct
7 Correct 39 ms 5520 KB Output is correct
8 Correct 39 ms 5612 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 324 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 320 KB Output is correct
23 Correct 23 ms 3012 KB Output is correct
24 Correct 29 ms 5188 KB Output is correct
25 Correct 53 ms 8676 KB Output is correct
26 Correct 36 ms 5572 KB Output is correct
27 Correct 46 ms 5428 KB Output is correct
28 Correct 63 ms 9184 KB Output is correct
29 Correct 62 ms 8680 KB Output is correct
30 Correct 36 ms 3644 KB Output is correct
31 Correct 64 ms 9072 KB Output is correct