답안 #806675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
806675 2023-08-04T08:44:02 Z Cookie Intercastellar (JOI22_ho_t1) C++14
100 / 100
73 ms 8716 KB
#include<bits/stdc++.h>
#include<fstream>
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx2")
using namespace std;
//ifstream fin("FEEDING.INP");
//ofstream fout("FEEDING.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const int base = 74;
const ll p = 31, mod = 1e9 + 7, inf = 1e9, mxv = 1005, mxn = 2e5 + 5;
int n;
ll a[mxn + 1], cnt[mxn + 1];
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)cin >> a[i];
    for(int i = 1; i <= n; i++){

        ll &x = a[i];
        while(x % 2 == 0){
            cnt[i]++; x /= 2;
        }
    }
    int q; cin >> q;
    int r = 1;
    ll tot = 0;
    while(q--){
        ll x; cin >> x;
        while(tot + (1LL << cnt[r]) < x){
            tot += (1LL << cnt[r]); r++;
        }
        cout << a[r] << "\n";
    }
    return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 16 ms 3940 KB Output is correct
4 Correct 27 ms 2360 KB Output is correct
5 Correct 55 ms 5452 KB Output is correct
6 Correct 23 ms 4020 KB Output is correct
7 Correct 37 ms 5516 KB Output is correct
8 Correct 37 ms 5636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 16 ms 3940 KB Output is correct
4 Correct 27 ms 2360 KB Output is correct
5 Correct 55 ms 5452 KB Output is correct
6 Correct 23 ms 4020 KB Output is correct
7 Correct 37 ms 5516 KB Output is correct
8 Correct 37 ms 5636 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 22 ms 3016 KB Output is correct
24 Correct 27 ms 5256 KB Output is correct
25 Correct 50 ms 8716 KB Output is correct
26 Correct 53 ms 5572 KB Output is correct
27 Correct 31 ms 5472 KB Output is correct
28 Correct 70 ms 8376 KB Output is correct
29 Correct 73 ms 7676 KB Output is correct
30 Correct 35 ms 3696 KB Output is correct
31 Correct 57 ms 8180 KB Output is correct