Submission #886785

# Submission time Handle Problem Language Result Execution time Memory
886785 2023-12-12T23:26:05 Z Maite_Morale Intercastellar (JOI22_ho_t1) C++14
100 / 100
397 ms 12376 KB
#include<bits/stdc++.h>
#define MAX 500005
#define oo 1e18
#define mod 1000000007
#define pll pair<long long,long long>
#define F first
#define S second
#define vll vector<long long>
#define vvll vector<vll>
using namespace std;
typedef long long ll;

ll n,m,a[MAX],d[MAX],q,a1;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];ll s=1;
        while(a[i]%2==0){
            a[i]/=2;s*=2;
        }
        d[i]=d[i-1]+s;
    }cin>>q;ll i=1;
    while(q--){
        cin>>a1;
        while(a1>d[i])i++;
        cout<<a[i]<<"\n";
    }
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 74 ms 7432 KB Output is correct
4 Correct 217 ms 8012 KB Output is correct
5 Correct 304 ms 8788 KB Output is correct
6 Correct 151 ms 7860 KB Output is correct
7 Correct 300 ms 8844 KB Output is correct
8 Correct 296 ms 8844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 2 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 2 ms 2480 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 74 ms 7432 KB Output is correct
4 Correct 217 ms 8012 KB Output is correct
5 Correct 304 ms 8788 KB Output is correct
6 Correct 151 ms 7860 KB Output is correct
7 Correct 300 ms 8844 KB Output is correct
8 Correct 296 ms 8844 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 2 ms 2396 KB Output is correct
20 Correct 2 ms 2480 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 3 ms 2396 KB Output is correct
23 Correct 175 ms 6908 KB Output is correct
24 Correct 172 ms 9448 KB Output is correct
25 Correct 344 ms 11980 KB Output is correct
26 Correct 206 ms 9812 KB Output is correct
27 Correct 169 ms 9552 KB Output is correct
28 Correct 360 ms 12368 KB Output is correct
29 Correct 361 ms 11856 KB Output is correct
30 Correct 260 ms 7676 KB Output is correct
31 Correct 397 ms 12376 KB Output is correct