Submission #887376

# Submission time Handle Problem Language Result Execution time Memory
887376 2023-12-14T11:13:21 Z salmon Intercastellar (JOI22_ho_t1) C++14
100 / 100
77 ms 8532 KB
#include <bits/stdc++.h>
using namespace std;

int N;
int lst[200100];
int Q;
long long int pre[200100];
long long int X;


int main(){

    scanf(" %d",&N);

    for(int i = 1; i <= N; i++){
        scanf(" %d",&lst[i]);
    }

    pre[0] = 0;

    for(int i = 1; i <= N; i++){
        pre[i] = pre[i - 1] + (1<<__builtin_ctz(lst[i]));
    }

    int it = 0;

    scanf(" %d",&Q);

    for(int i = 0; i < Q; i++){
        scanf(" %lld",&X);

        while(X > pre[it]) it++;

        printf("%d\n",lst[it] / (pre[it] - pre[it -1]) );
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:34:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   34 |         printf("%d\n",lst[it] / (pre[it] - pre[it -1]) );
      |                 ~^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                  |            |
      |                  int          long long int
      |                 %lld
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf(" %d",&lst[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf(" %d",&Q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         scanf(" %lld",&X);
      |         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 20 ms 3368 KB Output is correct
4 Correct 35 ms 3932 KB Output is correct
5 Correct 47 ms 4724 KB Output is correct
6 Correct 28 ms 3676 KB Output is correct
7 Correct 47 ms 4868 KB Output is correct
8 Correct 51 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2560 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 20 ms 3368 KB Output is correct
4 Correct 35 ms 3932 KB Output is correct
5 Correct 47 ms 4724 KB Output is correct
6 Correct 28 ms 3676 KB Output is correct
7 Correct 47 ms 4868 KB Output is correct
8 Correct 51 ms 4948 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2560 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 26 ms 4700 KB Output is correct
24 Correct 33 ms 5300 KB Output is correct
25 Correct 62 ms 8096 KB Output is correct
26 Correct 47 ms 5856 KB Output is correct
27 Correct 39 ms 5676 KB Output is correct
28 Correct 66 ms 8532 KB Output is correct
29 Correct 61 ms 7996 KB Output is correct
30 Correct 43 ms 5460 KB Output is correct
31 Correct 77 ms 8324 KB Output is correct