Submission #954624

#TimeUsernameProblemLanguageResultExecution timeMemory
954624sleepntsheepIntercastellar (JOI22_ho_t1)C11
100 / 100
84 ms8528 KiB
#include<stdio.h> #define N 200001 int q,n,a[N]; long long t[N]; void upd(int p,long long k){for(;p<N;p|=p+1)t[p]+=k;} int lb(long long k) { long long val=0,pos=0; for(int j=1<<19;j;j>>=1) if(pos+j<=N&&val+t[pos+j-1]<k)pos+=j,val+=t[pos-1]; return pos; } int main() { scanf("%d",&n); for(int i=1;i<=n;++i) { scanf("%d",a+i); int c=0; while(!(a[i]&1))++c,a[i]>>=1; upd(i,1ll<<c); } scanf("%d",&q); while(q--) { long long x; scanf("%lld",&x); printf("%d\n",a[lb(x)]); } }

Compilation message (stderr)

Main.c: In function 'main':
Main.c:16:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
Main.c:19:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d",a+i);
      |         ^~~~~~~~~~~~~~~
Main.c:24:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d",&q);
      |     ^~~~~~~~~~~~~~
Main.c:28:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%lld",&x);
      |         ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...