Submission #598786

#TimeUsernameProblemLanguageResultExecution timeMemory
598786denniskimIntercastellar (JOI22_ho_t1)C++17
100 / 100
88 ms10672 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 lll; typedef long double ld; #define MAX 9223372036854775807LL #define MIN -9223372036854775807LL #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second ll n; ll a[200010]; ll nu[200010]; ll fn[200010]; ll q; ll x; ll p; int main(void) { scanf("%lld", &n); for(ll i = 1 ; i <= n ; i++) scanf("%lld", &a[i]); for(ll i = 1 ; i <= n ; i++) { ll gap = a[i]; ll cou = 1; while(gap % 2 == 0) { gap /= 2; cou *= 2; } fn[i] = gap; nu[i] = nu[i - 1] + cou; } scanf("%lld", &q); while(q--) { scanf("%lld", &x); while(p <= n && nu[p] < x) p++; printf("%lld\n", fn[p]); } return 0; }

Compilation message (stderr)

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