# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
871125 | Marco_Escandon | Intercastellar (JOI22_ho_t1) | C++11 | 445 ms | 10836 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct st{
vector<ll> abi;
void update(ll a,ll b)
{
for(a; a<abi.size(); a+=(a&-a))
{
abi[a]+=b;
}
}
ll query(ll a)
{
ll s=0;
for(a; a>0; a-=(a&-a))
{
s+=abi[a];
}
return s;
}
st(ll n)
{
abi.resize(n*2);
}
};
int main()
{
ll n;
cin>>n;
ll cad[n+1];
st asd(n+1);
for(int i=1; i<=n; i++)
{
cin>>cad[i];
ll temp=0;
while(cad[i]%2==0)
{
cad[i]/=2;
temp++;
}
asd.update(i,pow(2,temp));
}
ll q;
cin>>q;
while(q--)
{
ll a=0, b=n+1;
ll en;
cin>>en;
//cout<<asd.query(en)<<" ";
while(abs(a-b)!=1)
{
ll m=(a+b)/2;
if(asd.query(m)>=en)
b=m;
else a=m;
}
cout<<cad[b]<<"\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |