# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
916623 | tuannm | Intercastellar (JOI22_ho_t1) | C++17 | 1 ms | 2396 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ii pair<int, int>
#define ll pair<long long, long long>
#define fi first
#define se second
#define pb push_back
using namespace std;
const int mod[2] = {1000000007, 998244353};
const int N = 2e5 + 1;
const string NAME = "";
const int lim = 2147483647;
//const unsigned int lim = 4294967295;
//const long long lim = 9223372036854775807;
//const unsigned long long lim = 18446744073709551615;
const int mset = 0x3f;
const double pi = acos(-1);
int n, q;
ll a[N];
long long sum[N];
void inp(){
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> a[i].fi;
a[i].se = 1;
while(a[i].fi % 2 == 0){
a[i].se *= 2;
a[i].fi /= 2;
}
sum[i] = sum[i - 1] + a[i].se;
cout << a[i].fi << ' ' << a[i].se << "\n";
}
cin >> q;
}
void solve(){
while(q--){
long long x;
cin >> x;
int l = 1, r = n, ans = n;
while(l <= r){
int mid = (l + r) / 2;
if(sum[mid] >= x){
ans = mid;
r = mid - 1;
}
else l = mid + 1;
}
cout << a[ans].fi << "\n";
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if(fopen((NAME + ".inp").c_str(), "r")){
freopen((NAME + ".inp").c_str(), "r", stdin);
freopen((NAME + ".out").c_str(), "w", stdout);
}
inp();
solve();
}
컴파일 시 표준 에러 (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... |