Submission #855195

# Submission time Handle Problem Language Result Execution time Memory
855195 2023-09-30T14:41:27 Z ancuber1031 Intercastellar (JOI22_ho_t1) C++14
25 / 100
723 ms 524288 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int,int>
#define p_q priority_queue
#define endl '\n'
#define pb push_back

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin>>n;    
    deque<int> a(n), ans;
    for (auto& i : a) cin>>i;
    while(!a.empty()) {
        int cur = a.back();
        a.pop_back();
        if (cur&1) {
            ans.push_front(cur);
        } else {
            a.push_back(cur>>1);
            a.push_back(cur>>1);
        }
    }
    
    int q; cin>>q;
    while(q--) {
        int x; cin>>x;
        cout<<ans[--x]<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 18 ms 3016 KB Output is correct
4 Correct 20 ms 2140 KB Output is correct
5 Correct 35 ms 4436 KB Output is correct
6 Correct 22 ms 4176 KB Output is correct
7 Correct 36 ms 5460 KB Output is correct
8 Correct 48 ms 9200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 723 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 18 ms 3016 KB Output is correct
4 Correct 20 ms 2140 KB Output is correct
5 Correct 35 ms 4436 KB Output is correct
6 Correct 22 ms 4176 KB Output is correct
7 Correct 36 ms 5460 KB Output is correct
8 Correct 48 ms 9200 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Runtime error 723 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -