# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
801866 | vjudge1 | Intercastellar (JOI22_ho_t1) | C++14 | 82 ms | 9224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std ;
const int N = 2e5 ;
ll n, q, pref[N + 10] ;
vector<pair<ll, ll>> v ;
main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
cin >> n ;
v.push_back({0, 0}) ;
for(ll i = 1 ; i <= n ; i++)
{
ll a, kol = 0 ;
cin >> a ;
while(!(a & 1))
{
kol++ ;
a >>= 1 ;
}
v.push_back({(1 << kol), a}) ;
}
cin >> q ;
for(int i = 1 ; i < v.size() ; i++)
pref[i] = pref[i - 1] + v[i].fi ;
while(q--)
{
ll x, l = 0, r = v.size() ;
cin >> x ;
while(l + 1 < r)
{
int mid = (l + r) >> 1 ;
if(pref[mid] < x)
l = mid ;
else
r = mid ;
}
cout << v[r].se << '\n' ;
}
return 0 ;
}
컴파일 시 표준 에러 (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... |