답안 #982187

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982187 2024-05-14T02:28:49 Z Aiperiii Intercastellar (JOI22_ho_t1) C++14
25 / 100
354 ms 524288 KB
#include <bits/stdc++.h>
#define int long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector <int> a(n),v;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==1)v.pb(a[i]);
        else{
            int x=a[i];
            int cnt=1;
            while(x%2==0){
                x/=2;
                cnt*=2;
            }
            while(cnt--)v.pb(x);
        }
    }
    int q;
    cin>>q;
    while(q--){
        int pos;
        cin>>pos;
        cout<<v[pos-1]<<"\n";
    }
}
/*
4
14
9
8
12
6
2
3
5
7
11
13
 
 
13
1
4
1
4
2
1
3
5
6
2
3
7
3
8
2
10
11
13
15
17
18
20
 
*/




# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 33 ms 6464 KB Output is correct
4 Correct 45 ms 2956 KB Output is correct
5 Correct 76 ms 8124 KB Output is correct
6 Correct 47 ms 10940 KB Output is correct
7 Correct 79 ms 10880 KB Output is correct
8 Correct 82 ms 19440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 354 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 33 ms 6464 KB Output is correct
4 Correct 45 ms 2956 KB Output is correct
5 Correct 76 ms 8124 KB Output is correct
6 Correct 47 ms 10940 KB Output is correct
7 Correct 79 ms 10880 KB Output is correct
8 Correct 82 ms 19440 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Runtime error 354 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -