제출 #824342

#제출 시각아이디문제언어결과실행 시간메모리
824342AmylopectinIntercastellar (JOI22_ho_t1)C++14
100 / 100
57 ms8416 KiB
#include <stdio.h> #include <iostream> #include <algorithm> using namespace std; const long long mxn = 1e6 + 10; long long val[mxn] = {},npie[mxn] = {},len[mxn] = {},ans[mxn] = {}; int main() { long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru; scanf("%lld",&n); for(i=0; i<n; i++) { scanf("%lld",&val[i]); npie[i] = 1; len[i] = val[i]; for(j=0; j<50; j++) { if(1 & len[i]) { break; } else { npie[i] <<= 1; len[i] >>= 1; } } if(i > 0) npie[i] += npie[i-1]; } scanf("%lld",&m); cru = 0; for(i=0; i<m; i++) { scanf("%lld",&cn); while(cn > npie[cru]) { cru ++; } ans[i] = len[cru]; // printf("%lld\n",len[cru]); } for(i=0; i<m; i++) { printf("%lld\n",ans[i]); } }

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

Main.cpp: In function 'int main()':
Main.cpp:9:26: warning: unused variable 'cm' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                          ^~
Main.cpp:9:29: warning: unused variable 'fn' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                             ^~
Main.cpp:9:32: warning: unused variable 'fm' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                                ^~
Main.cpp:9:35: warning: unused variable 'cl' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                                   ^~
Main.cpp:9:38: warning: unused variable 'cr' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                                      ^~
Main.cpp:9:41: warning: unused variable 'mid' [-Wunused-variable]
    9 |     long long i,j,n,m,cn,cm,fn,fm,cl,cr,mid,cru;
      |                                         ^~~
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lld",&val[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%lld",&m);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         scanf("%lld",&cn);
      |         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...