Submission #700186

#TimeUsernameProblemLanguageResultExecution timeMemory
700186ToxtaqIntercastellar (JOI22_ho_t1)C++17
100 / 100
414 ms6836 KiB
#include<bits/stdc++.h>
using namespace std;
int main()
{
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
    int n;
    cin >> n;
    vector<int>v(n);
    for(int i = 0;i < n;++i)cin >> v[i];
    long long q, indx = -1, tempo = 0;
    cin >> q;
    while(q--){
        long long x;
        cin >> x;
        int tmp;
        while(tempo < x && indx + 1 < n){
            indx++;
            tmp = v[indx];
            while(tmp % 2 == 0){
                tmp /= 2;
            }
            tempo += v[indx] / tmp;
        }
        cout << tmp << '\n';
    }
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:25:24: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |         cout << tmp << '\n';
      |                        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...