답안 #527911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527911 2022-02-18T17:10:39 Z SorahISA Intercastellar (JOI22_ho_t1) C++17
100 / 100
125 ms 9084 KB
#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
#define double long double
using pii = pair<int, int>;
template <typename T>
using Prior = std::priority_queue<T>;
template <typename T>
using prior = std::priority_queue<T, vector<T>, greater<T>>;

#define X first
#define Y second
#define ee emplace
#define eb emplace_back
#define ef push_front
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())

#ifdef local
#define fastIO() void()
#define debug(...) \
    cerr << "\u001b[33m" << "At func " << __FUNCTION__ << ", line " << __LINE__ << ": ",\
    cerr << "(" << #__VA_ARGS__ << ") = ",\
    _do(__VA_ARGS__),\
    cerr << "\u001b[0m"
template <typename T> void _do(T &&_t) {cerr << _t << "\n";}
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) {cerr << _t << ", ", _do(_u...);}
#else
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(...) void()
#endif

template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

void solve() {
    int N; cin >> N;
    
    vector<int> A(N), L{1};
    for (int &x : A) cin >> x, L.eb(L.back() + (x & -x)), x /= x & -x;
    
    int Q; cin >> Q;
    
    int tok = 0;
    while (Q--) {
        int x; cin >> x;
        while (L[tok+1] <= x) ++tok;
        cout << A[tok] << "\n";
        // debug(A[tok]);
    }
}

int32_t main() {
    fastIO();
    
    int t = 1; // cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        solve();
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 18 ms 4284 KB Output is correct
4 Correct 34 ms 2240 KB Output is correct
5 Correct 50 ms 5032 KB Output is correct
6 Correct 32 ms 4204 KB Output is correct
7 Correct 63 ms 5116 KB Output is correct
8 Correct 62 ms 5640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 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 324 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 18 ms 4284 KB Output is correct
4 Correct 34 ms 2240 KB Output is correct
5 Correct 50 ms 5032 KB Output is correct
6 Correct 32 ms 4204 KB Output is correct
7 Correct 63 ms 5116 KB Output is correct
8 Correct 62 ms 5640 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 296 KB Output is correct
17 Correct 0 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 324 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 324 KB Output is correct
23 Correct 37 ms 2916 KB Output is correct
24 Correct 41 ms 4956 KB Output is correct
25 Correct 65 ms 8160 KB Output is correct
26 Correct 48 ms 5264 KB Output is correct
27 Correct 48 ms 5088 KB Output is correct
28 Correct 76 ms 9084 KB Output is correct
29 Correct 76 ms 8080 KB Output is correct
30 Correct 47 ms 3736 KB Output is correct
31 Correct 125 ms 8968 KB Output is correct