답안 #1086617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086617 2024-09-11T07:00:33 Z dwuy Intercastellar (JOI22_ho_t1) C++14
100 / 100
48 ms 9312 KB
/**         - dwuy -

      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ

**/
#include <bits/stdc++.h>

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"
#define int long long

using namespace std;

typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 200005;

int n;
int a[MX];
int b[MX];

int32_t main(){
    fastIO;
    //file(TASK);

    cin >> n;
    for(int i=1; i<=n; i++) cin >> a[i];
    for(int i=1; i<=n; i++){
        b[i] = b[i-1] + (-a[i]&a[i]);
        while(a[i]&1^1) a[i] >>= 1;
    }
    int q;
    cin >> q;
    int i = 1;
    while(q--){
        int x; cin >> x;
        while(b[i] < x) i++;
        cout << a[i] << endl;
    }

    return 0;
}




Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:49:19: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   49 |         while(a[i]&1^1) a[i] >>= 1;
      |               ~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 12 ms 4132 KB Output is correct
4 Correct 16 ms 2396 KB Output is correct
5 Correct 30 ms 5468 KB Output is correct
6 Correct 20 ms 4188 KB Output is correct
7 Correct 30 ms 5460 KB Output is correct
8 Correct 28 ms 5716 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 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 348 KB Output is correct
7 Correct 0 ms 488 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 464 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 12 ms 4132 KB Output is correct
4 Correct 16 ms 2396 KB Output is correct
5 Correct 30 ms 5468 KB Output is correct
6 Correct 20 ms 4188 KB Output is correct
7 Correct 30 ms 5460 KB Output is correct
8 Correct 28 ms 5716 KB Output is correct
9 Correct 0 ms 348 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 348 KB Output is correct
15 Correct 0 ms 488 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 464 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 16 ms 3152 KB Output is correct
24 Correct 23 ms 5204 KB Output is correct
25 Correct 44 ms 8800 KB Output is correct
26 Correct 28 ms 5720 KB Output is correct
27 Correct 27 ms 5700 KB Output is correct
28 Correct 48 ms 9312 KB Output is correct
29 Correct 48 ms 8788 KB Output is correct
30 Correct 24 ms 3676 KB Output is correct
31 Correct 47 ms 9248 KB Output is correct