Submission #700189

#TimeUsernameProblemLanguageResultExecution timeMemory
700189ToxtaqIntercastellar (JOI22_ho_t1)C++17
100 / 100
78 ms2892 KiB
#include<cstdio> #include<vector> using namespace std; int main() { int n; scanf("%d", &n); vector<int>v(n); for(int i = 0;i < n;++i)scanf("%d", &v[i]); long long indx = -1, tempo = 0; int q; scanf("%d", &q); while(q--){ long long x; scanf("%lld", &x); int tmp; while(tempo < x && indx + 1 < n){ indx++; tmp = v[indx]; while(tmp % 2 == 0){ tmp /= 2; } tempo += v[indx] / tmp; } printf("%d\n", tmp); } }

Compilation message (stderr)

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