답안 #805643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805643 2023-08-03T19:23:25 Z kirakaminski968 Intercastellar (JOI22_ho_t1) C++17
100 / 100
361 ms 7740 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    int N; cin >> N;
    vector<pair<int,int>> ans;
    for(int i = 0;i<N;++i){
        int x; cin >> x;
        int y = 1;
        while(x % 2 == 0){
            x /= 2; y *= 2;
        }
        ans.push_back({y,x});
        //cout << y << " " << x << "\n";
    }
    //cout << ans[0].first << "\n";
    int Q; cin >> Q;
    int i = 0; ll cur = 0;
    while(Q--){
        ll x; cin >> x;
        while(i < N && cur+ans[i].first < x){
            cur += ans[i].first;
            i++;
        }
        //cout << i-1 << " " << cur << "\n";
        cout << ans[i].second << "\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 70 ms 2880 KB Output is correct
4 Correct 195 ms 2056 KB Output is correct
5 Correct 297 ms 4128 KB Output is correct
6 Correct 141 ms 2952 KB Output is correct
7 Correct 296 ms 4112 KB Output is correct
8 Correct 296 ms 4300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 296 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 70 ms 2880 KB Output is correct
4 Correct 195 ms 2056 KB Output is correct
5 Correct 297 ms 4128 KB Output is correct
6 Correct 141 ms 2952 KB Output is correct
7 Correct 296 ms 4112 KB Output is correct
8 Correct 296 ms 4300 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 296 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 170 ms 2880 KB Output is correct
24 Correct 150 ms 4208 KB Output is correct
25 Correct 327 ms 7344 KB Output is correct
26 Correct 194 ms 4744 KB Output is correct
27 Correct 170 ms 4548 KB Output is correct
28 Correct 361 ms 7740 KB Output is correct
29 Correct 350 ms 7228 KB Output is correct
30 Correct 228 ms 3576 KB Output is correct
31 Correct 354 ms 7704 KB Output is correct