Submission #1223211

#TimeUsernameProblemLanguageResultExecution timeMemory
1223211TadijaSebezIntercastellar (JOI22_ho_t1)C++20
100 / 100
49 ms3908 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const int N=200050;
ll a[N];

int main(){
    int n;
    scanf("%i",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    int q;
    scanf("%i",&q);
    int ptr=0;
    ll left=0;
    while(q--){
        ll x;
        scanf("%lld",&x);
        while(left<x){
            ptr++;
            ll now=1;
            while(a[ptr]%2==0){
                now*=2;
                a[ptr]/=2;
            }
            left+=now;
        }
        printf("%lld\n",a[ptr]);
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
Main.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%i",&q);
      |     ~~~~~^~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%lld",&x);
      |         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...