답안 #1003995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003995 2024-06-20T22:19:58 Z CSQ31 Intercastellar (JOI22_ho_t1) C++17
100 / 100
49 ms 9408 KB
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
    owo
    int n;
    cin>>n;
    vector<PII>a;
    for(int i=0;i<n;i++){
        ll x;
        cin>>x;
        int z = 1;
        while(x%2 == 0){
            x/=2;
            z*=2;
        }
        a.pb({z,x});
    }
    int q;
    cin>>q;
    ll ptr = -1,sum = 0;
    while(q--){
        ll x;
        cin>>x;
        while(sum < x){
            ptr++;
            sum+=a[ptr].fi;
        }
        cout<<a[ptr].se<<'\n';

    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 14 ms 5008 KB Output is correct
4 Correct 18 ms 2516 KB Output is correct
5 Correct 30 ms 5828 KB Output is correct
6 Correct 20 ms 5072 KB Output is correct
7 Correct 41 ms 5916 KB Output is correct
8 Correct 33 ms 5892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 352 KB Output is correct
6 Correct 0 ms 344 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 352 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 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 344 KB Output is correct
3 Correct 14 ms 5008 KB Output is correct
4 Correct 18 ms 2516 KB Output is correct
5 Correct 30 ms 5828 KB Output is correct
6 Correct 20 ms 5072 KB Output is correct
7 Correct 41 ms 5916 KB Output is correct
8 Correct 33 ms 5892 KB Output is correct
9 Correct 1 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 352 KB Output is correct
14 Correct 0 ms 344 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 352 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 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 17 ms 3292 KB Output is correct
24 Correct 23 ms 6096 KB Output is correct
25 Correct 49 ms 8896 KB Output is correct
26 Correct 36 ms 5832 KB Output is correct
27 Correct 28 ms 6088 KB Output is correct
28 Correct 49 ms 9404 KB Output is correct
29 Correct 49 ms 8892 KB Output is correct
30 Correct 27 ms 3900 KB Output is correct
31 Correct 49 ms 9408 KB Output is correct