# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
815905 | vjudge1 | Intercastellar (JOI22_ho_t1) | C++17 | 283 ms | 10852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
void open(){
if(fopen("input.inp", "r")){
freopen("input.inp", "r", stdin);
//freopen("output.out", "w", stdout);
}
}
const int maxn = 2e5 + 5;
int n;
int A[maxn];
int q;
int lowest[maxn];
int depth[maxn];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
open();
cin >> n;
for(int i = 1; i <= n; i++){
cin >> A[i];
int temp = A[i];
int cnt = 0;
while(temp % 2 == 0){
temp /= 2;
cnt++;
}
lowest[i] = temp;
depth[i] = (1LL << cnt);
}
int cur_pos = 0;
int prefix = 0;
cin >> q;
while(q--){
int x;
cin >> x;
while(cur_pos < n && prefix < x){
prefix += depth[++cur_pos];
}
cout << lowest[cur_pos] << endl;
}
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... |