# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1088381 | peacebringer1667 | Intercastellar (JOI22_ho_t1) | C++17 | 53 ms | 11684 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define ldb long double
#define fi first
#define se second
#define sza(a) (int)a.size()
#define pir pair<int,int>
#define pirll pair<ll,ll>
using namespace std;
const int maxn = 2e5 + 5;
const ll cap = 1e15;
struct CTDL{
ll l = 0,r = 0;int val = 0;
};
vector <CTDL> vec;
int a[maxn],p = 0;
void gen(int n){
ll cur = 0;
for (int i = 1 ; i <= n ; i++){
int cnt = 1;
while (a[i] % 2 == 0){
a[i] /= 2;cnt *= 2;
}
vec.push_back({cur + 1,cur + cnt,a[i]});
cur += cnt;
if (cur > cap) break;
}
}
int solve(ll x){
while (p < vec.size() && vec[p].r < x) p++;
return vec[p].val;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int n,q;
cin >> n;
for (int i = 1 ; i <= n ; i++) cin >> a[i];
gen(n);
cin >> q;
while (q--){
ll x;
cin >> x;
cout << solve(x) << "\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... |