Submission #760179

# Submission time Handle Problem Language Result Execution time Memory
760179 2023-06-17T09:06:49 Z Petrix Intercastellar (JOI22_ho_t1) C++17
25 / 100
340 ms 4828 KB
#include <iostream>
using namespace std;

struct sirNou{
    int s,e,val;
} v[200001];

void gasesteVal(int a,int i){
    int put=1;
    while(a%2==0){
        put*=2;
        a/=2;
    }
    v[i].s=v[i-1].e+1;
    v[i].e=v[i-1].e+put;
    v[i].val=a;
}

int main()
{
    int n,i,q,st,dr,mij,a,gas;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>a;
        if(a%2==1){
            v[i].val=a;
            v[i].s=v[i].e=v[i-1].e+1;
        }else{
            gasesteVal(a,i);
        }
    }
    cin>>q;
    for(i=0;i<q;i++){
        cin>>gas;
        st=1;dr=n;
        while(st<=dr){
            mij=(st+dr)/2;
            if(v[mij].s<=gas && v[mij].e>=gas){
                cout<<v[mij].val<<"\n";
                break;
            }else if(v[mij].s>gas){
                dr=mij-1;
            }else{
                st=mij+1;
            }
        }


    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 101 ms 3220 KB Output is correct
4 Correct 200 ms 2052 KB Output is correct
5 Correct 315 ms 4820 KB Output is correct
6 Correct 191 ms 3392 KB Output is correct
7 Correct 296 ms 4828 KB Output is correct
8 Correct 340 ms 4756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Incorrect 1 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 101 ms 3220 KB Output is correct
4 Correct 200 ms 2052 KB Output is correct
5 Correct 315 ms 4820 KB Output is correct
6 Correct 191 ms 3392 KB Output is correct
7 Correct 296 ms 4828 KB Output is correct
8 Correct 340 ms 4756 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Incorrect 1 ms 308 KB Output isn't correct
18 Halted 0 ms 0 KB -