답안 #936123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936123 2024-03-01T07:35:45 Z weakweakweak Intercastellar (JOI22_ho_t1) C++14
25 / 100
510 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

int main () {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, q, x;
    vector <int> v;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        vector<int> stk = {x};
        vector<int> v2;
        while (stk.size()) {
            int x = stk.back(); stk.pop_back();
            if (x % 2) v2.push_back(x); 
            else {
                stk.push_back(x / 2);
                stk.push_back(x / 2);
            }
        }
        reverse(v2.begin(), v2.end());
        for (int x : v2) v.push_back(x);
    }
    cin >> q;
    while (q--) {
        cin >> x;
        cout << v[x - 1] << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 31 ms 3152 KB Output is correct
4 Correct 24 ms 2264 KB Output is correct
5 Correct 54 ms 4548 KB Output is correct
6 Correct 46 ms 6100 KB Output is correct
7 Correct 56 ms 6564 KB Output is correct
8 Correct 79 ms 9668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 510 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 31 ms 3152 KB Output is correct
4 Correct 24 ms 2264 KB Output is correct
5 Correct 54 ms 4548 KB Output is correct
6 Correct 46 ms 6100 KB Output is correct
7 Correct 56 ms 6564 KB Output is correct
8 Correct 79 ms 9668 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Runtime error 510 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -