이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define ep emplace
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
const ll INF=1e18;
const ll mod=1e9+7;
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int n, q; cin >> n;
vector<pl> v;
for(int i=0;i<n;i++)
{
int a; cin >> a;
ll cnt=1;
while(a%2==0) a/=2, cnt*=2;
v.eb(cnt, a);
}
ll i=0, sum=0;
cin >> q;
while(q--)
{
ll x; cin >> x;
while(i<n and sum+v[i].fi<x) sum+=v[i].fi, i++;
cout << v[i].se << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |