제출 #887376

#제출 시각아이디문제언어결과실행 시간메모리
887376salmonIntercastellar (JOI22_ho_t1)C++14
100 / 100
77 ms8532 KiB
#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]) );
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...