답안 #534073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534073 2022-03-08T00:28:06 Z LittleOrange Intercastellar (JOI22_ho_t1) C++17
100 / 100
72 ms 6836 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n,0);
    for (int i = 0;i<n;i++){
        cin >> a[i];
    }
    vector<pair<ll,ll> > dat(n+1);
    dat[0] = {0,0};
    for (int i = 0;i<n;i++){
        ll v = a[i];
        ll c = 1;
        while (v&1^1){
            v>>=1;
            c<<=1;
        }
        dat[i+1] = {dat[i].first+c,v};
    }
    int q;
    cin >> q;
    while (q--){
        ll x;
        cin >> x;
        cout << (*lower_bound(dat.begin(),dat.end(),make_pair(x,0LL))).second << "\n";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:17:17: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   17 |         while (v&1^1){
      |                ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 20 ms 4960 KB Output is correct
4 Correct 30 ms 1824 KB Output is correct
5 Correct 48 ms 5464 KB Output is correct
6 Correct 30 ms 4508 KB Output is correct
7 Correct 54 ms 5536 KB Output is correct
8 Correct 48 ms 5476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 312 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 20 ms 4960 KB Output is correct
4 Correct 30 ms 1824 KB Output is correct
5 Correct 48 ms 5464 KB Output is correct
6 Correct 30 ms 4508 KB Output is correct
7 Correct 54 ms 5536 KB Output is correct
8 Correct 48 ms 5476 KB Output is correct
9 Correct 0 ms 316 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 312 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 32 ms 2268 KB Output is correct
24 Correct 33 ms 4616 KB Output is correct
25 Correct 63 ms 6836 KB Output is correct
26 Correct 41 ms 4172 KB Output is correct
27 Correct 37 ms 4068 KB Output is correct
28 Correct 72 ms 6300 KB Output is correct
29 Correct 72 ms 5652 KB Output is correct
30 Correct 38 ms 1860 KB Output is correct
31 Correct 72 ms 6084 KB Output is correct