답안 #873759

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873759 2023-11-15T16:30:47 Z Alex Intercastellar (JOI22_ho_t1) C++14
100 / 100
139 ms 31420 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int Dos(int n)
{
    return (n & (~(n - 1)));
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    map<int,int>m;
    vector<int>v;
    map<int,int>m2;
    int cont = 0;
    for(int i = 0 ; i < n ; i++){
        int a; cin >> a;

        if(!(a & 1)){
        int l = Dos(a);
        cont += l - 1;
        v.push_back(cont);
        if(l == a){
        m[cont] = 1;
        }
        else
        m[cont] = a / l;

        }
        else
        m[cont] = a;

        cont++;
        }

    int ms ;
    cin >> ms;
    for(int i = 0 ; i < ms ; i++){
        int k ; cin >> k;
        if(m[k - 1] != 0){
            cout << m[k - 1] << "\n";
            }
        else{
            vector<int>::iterator low;
            low = lower_bound(v.begin() , v.end() , k -1);
            cout << m[*low] << "\n";
            }
    }





}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 52 ms 13816 KB Output is correct
4 Correct 47 ms 5824 KB Output is correct
5 Correct 106 ms 17528 KB Output is correct
6 Correct 67 ms 14656 KB Output is correct
7 Correct 118 ms 19952 KB Output is correct
8 Correct 128 ms 26048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 52 ms 13816 KB Output is correct
4 Correct 47 ms 5824 KB Output is correct
5 Correct 106 ms 17528 KB Output is correct
6 Correct 67 ms 14656 KB Output is correct
7 Correct 118 ms 19952 KB Output is correct
8 Correct 128 ms 26048 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 37 ms 6228 KB Output is correct
24 Correct 62 ms 14016 KB Output is correct
25 Correct 114 ms 22592 KB Output is correct
26 Correct 76 ms 18136 KB Output is correct
27 Correct 72 ms 17796 KB Output is correct
28 Correct 139 ms 30912 KB Output is correct
29 Correct 135 ms 31420 KB Output is correct
30 Correct 73 ms 13104 KB Output is correct
31 Correct 136 ms 30852 KB Output is correct