답안 #881725

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881725 2023-12-01T19:11:41 Z AlphaMale06 Intercastellar (JOI22_ho_t1) C++14
100 / 100
58 ms 7780 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define pb push_back



signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i< n; i++)cin >> a[i];
    int q;
    cin >> q;
    int cnt=0;
    while(a[0]%2==0){
        a[0]/=2;
        cnt++;
    }
    int num=(1<<cnt)-1;
    int first=a[0];
    int p=1;
    while(q--){
        int x;
        cin >> x;
        x--;
        if(x<=num)cout << first << '\n';
        else{
            while(num<x){
                cnt=0;
                while(a[p]%2==0){
                    a[p]/=2;
                    cnt++;
                }
                first=a[p];
                num+=1<<cnt;
                p++;
            }
            cout << first << '\n';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 15 ms 1956 KB Output is correct
4 Correct 19 ms 1116 KB Output is correct
5 Correct 34 ms 2296 KB Output is correct
6 Correct 20 ms 1880 KB Output is correct
7 Correct 35 ms 2388 KB Output is correct
8 Correct 32 ms 2384 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 368 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 15 ms 1956 KB Output is correct
4 Correct 19 ms 1116 KB Output is correct
5 Correct 34 ms 2296 KB Output is correct
6 Correct 20 ms 1880 KB Output is correct
7 Correct 35 ms 2388 KB Output is correct
8 Correct 32 ms 2384 KB Output is correct
9 Correct 0 ms 344 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 344 KB Output is correct
14 Correct 0 ms 368 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 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 20 ms 2900 KB Output is correct
24 Correct 27 ms 4176 KB Output is correct
25 Correct 48 ms 7252 KB Output is correct
26 Correct 31 ms 4688 KB Output is correct
27 Correct 30 ms 4432 KB Output is correct
28 Correct 55 ms 7780 KB Output is correct
29 Correct 50 ms 7132 KB Output is correct
30 Correct 28 ms 3632 KB Output is correct
31 Correct 58 ms 7484 KB Output is correct