Submission #970486

# Submission time Handle Problem Language Result Execution time Memory
970486 2024-04-26T15:43:40 Z jadai007 Intercastellar (JOI22_ho_t1) C++14
35 / 100
11 ms 4644 KB
#include<bits/stdc++.h>
#define int long long

using namespace std;

int n,q, ans[100100], arr[100100];

int solve(int n){
    int idx = 1;
    while(n%2==0){
        n/=2;
        idx++;
    }
    return pow(2, idx - 1);
}

signed main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n;  
    for(int i = 1; i<=n; ++i) cin >> arr[i];
    for(int i = 1; i<=n; ++i){
        ans[i] = solve(arr[i]);
        ans[i]+=ans[i - 1];
    }
    cin >> q;
    while(q--){
        int x; cin >> x;
        int i = lower_bound(ans+1, ans+1+n, x) - ans;
        cout << arr[i] / (ans[i] - ans[i - 1]) << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 464 KB Output is correct
3 Runtime error 11 ms 4644 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 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 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 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 468 KB Output is correct
14 Correct 1 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 464 KB Output is correct
3 Runtime error 11 ms 4644 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -